      program cnteqhponn
C..............................................Sep 2022
C Number of EQs with Hpo_pre>=<Hpo(t0), Weq_pre>=<Hpo(t0)
C				   Hpo_nexe>=<Hpo(t0), Weq_nexer>=<Hpo(t0)
C Depth < 30 km, Depth > 30 km
C total number of EQs 1810 (19952020)
	CHARACTER*64 outfile,infile
C
       infile='addeqhpotot.txt'
	outfile='cnteqhponn.txt'
	OPEN(11,file=infile,action='READ')
	OPEN(12,file=outfile,access='APPEND')
C
   35 format(1X,F8.3,1X,I3,4(1X,I2),2(1X,F6.2),1X,I4,2(1X,F4.1)
     +,2(1X,I4),1X,F5.2,2(1X,I3,1X,F7.3),1X,I4)
        icntdkm=0
	nn=0
	idlim=30
	icnpre1=0  !Ipre >Ito
	icnpre2=0  !Ipre =Ito
	icnpre3=0  !Ipre <Ito
	icnnex1=0  !Inex >Ito
	icnnex2=0  !Inex =Ito
	icnnex3=0  !Inex <Ito
	DO iev=1,1954
C
	read(11,35,end=50) ryear,lda,imn,idy,iuteq,imm,glats,glons,kmds
 	+,aeqmax,eqav,ndyeq,knum,hpeq,jt_pre,hp_pre,jt_nex,hp_nex,ndy
      iyear=int(ryear)
	nn=nn+1
C Depth
C        if(kmds.le.idlim) then  ! Depth <=30
	if(kmds.gt.idlim) then
C
         icntdkm=icntdkm+1
	if (hp_pre.gt.hpeq) icnpre1=icnpre1+1
      if (hp_pre.eq.hpeq) icnpre2=icnpre2+1
	if (hp_pre.lt.hpeq) icnpre3=icnpre3+1
	if (hp_nex.gt.hpeq) icnnex1=icnnex1+1
      if (hp_nex.eq.hpeq) icnnex2=icnnex2+1
	if (hp_nex.lt.hpeq) icnnex3=icnnex3+1
	endif
	ENDDO
   50 close(11)
      write(*,34) idlim,icntdkm,nn,icnpre1,icnpre2,icnpre3
	+,icnnex1,icnnex2,icnnex3
	write(12,34) idlim,icntdkm,nn,icnpre1,icnpre2,icnpre3
	+,icnnex1,icnnex2,icnnex3
	close(12)
   34 format(1X,I3,2(1X,I4),2(1X,3(1X,I4)))
	pause ' '
		STOP
	END