      program cntkp3thr
       character*45 infile,outfile,txt
C
      infile='extpchcat5n-.txt'
	OPEN(10,file=infile,action='READ')
	read(10,*) txt
	outfile='catpcheff11-.res'
	OPEN(11,file=outfile,access='APPEND')
	write(11,*) infile
C
   30 format(99X,I2)
   33 format(1X,4(1X,I4))  ! out
	kth0=42	 !kp
	kth1=50	 !kp
	kth2=64  !kp
	icntot=0
	icntd=0
	icntm=0
	icnti=0
C	DO ii=1,272
    1   read(10,30,end=40) kp
          icntot=icntot+1
	if ((kp.ge.kth0).and.(kp.lt.kth1)) then
	icntd=icntd+1
	endif
	if ((kp.ge.kth1).and.(kp.lt.kth2)) then
	icntm=icntm+1
	endif
	if (kp.ge.kth2) then
	icnti=icnti+1
	endif
	goto 1
   40 close(unit=10)
	write(*,*) infile
	write(11,*) infile
	write(*,33) icntd,icntm,icnti,icntot
	write(11,33) icntd,icntm,icnti,icntot
	close(unit=11)
	pause ' '
	STOP
	END
