      subroutine median5183(CC,mqua,medi,maxp)
C...........................................................June 2021
C
	DIMENSION CC(0:72,71),X1(5183),X2(5183)
C "MEDIAN:"
      ndnr=5183
C
      MM=0
      N=0
      DO lat=1,71
	DO lon=0,72
	N=N+1
      X1(N)=CC(lon,lat)
      ENDDO 
	ENDDO
  880 XX=0.
CREM MAX X1(N)
  890 DO N=1,ndnr
  900 IF (XX.lt.X1(N)) THEN 
      XX=X1(N)
	ENDIF
      ENDDO      !N
  920 IF (XX.eq.0) GOTO 980
C
  930 DO 960 N=1,ndnr
      IF (X1(N).lt.XX) GOTO 960
      MM=MM+1 
      X2(MM)=XX 
	X1(N)=0.
  960 CONTINUE      ! N
  970 IF (MM.lt.NDNR) GOTO 880
  980 XMM=FLOAT(MM)
      quar=XMM/4.
      XD1=XMM/2.
      ND1=INT(XD1)
	CD1=FLOAT(ND1) 
      ND2=ND1+1 
      IF (CD1.LT.XD1) THEN 
	XMD=X2(ND2)
	else
	XMD=(X2(ND1)+X2(ND2))/2.
	ENDIF
C
       medi=nint(xmd)
	maxp=nint(X2(1))
	mqua=nint(quar)+medi
c
 1050 RETURN
      END