	integer count(100,3)

	do j=1,3
	  do i=1,100
	    count(i,j) = 0
	  end do
	end do

	open(1,file='lmc_u2o901.phot.fake',status='old')

1	read(1,*,end=99) jchip, xf, yf, u, b, v, r, ai, f555, f814, 
     &     ichip, x, y, chi, sn, sharp, round, pa, itype, c, sky, a555

	imag = nint((f555-10)/.25)
	count(imag,1) = count(imag,1) + 1
        if (a555 .lt. 90. .and. abs(xf-x) .lt. 3 .and. 
     &       abs(yf-y) .lt. 3) then
          count(imag,2) = count(imag,2) + 1
          if (chi .lt. 1.5) then
            count(imag,3) = count(imag,3) + 1
          end if
        end if
	goto 1

99	continue
	do i=1,100
	  if (count(i,1) .gt. 0) print *, 10+i*.25, (count(i,j),j=1,3),
     &            (float(count(i,j))/count(i,1),j=2,3)
        end do

	stop
	end 
