	program main

	parameter(MAXDAT=50000000)

	real freq(25),sum,value,sumsq,nd,mean,var

	open(1,file='post-au.out') 
	read(1,*)
	read(1,*)
	read(1,*)
	open(2,file='freq-au.out')
	do iz=1,220
	write(*,*) 'Currently on level ',iz
	do iy=1,270
	do ix=1,375
		read(1,*) value
		if(value.lt.0.00001) goto 99
		sum=sum+value
		sumsq=sumsq+value*value
		nd=nd+1
		if(value.lt.0) then
			freq(1)=freq(1)+1
		else
		if(value.lt.0.5) then
			freq(2)=freq(2)+1
		else
		if(value.lt.1.0) then
			freq(3)=freq(3)+1
		else
		if(value.lt.1.5) then
			freq(4)=freq(4)+1
		else
		if(value.lt.2.0) then
			freq(5)=freq(5)+1
		else
		if(value.lt.2.5) then
			freq(6)=freq(6)+1
		else
		if(value.lt.3.0) then
			freq(7)=freq(7)+1
		else
		if(value.lt.3.5) then
			freq(8)=freq(8)+1
		else
		if(value.lt.4.0) then
			freq(9)=freq(9)+1
		else
		if(value.lt.4.5) then
			freq(10)=freq(10)+1
		else
		if(value.lt.5.0) then
			freq(11)=freq(11)+1
		else
		if(value.lt.5.5) then
			freq(12)=freq(12)+1
		else
		if(value.lt.6.0) then
			freq(13)=freq(13)+1
		else
		if(value.lt.6.5) then
			freq(14)=freq(14)+1
		else
		if(value.lt.7.0) then
			freq(15)=freq(15)+1
		else
		if(value.lt.7.5) then
			freq(16)=freq(16)+1
		else
		if(value.lt.8.0) then
			freq(17)=freq(17)+1
		else
		if(value.lt.8.5) then
			freq(18)=freq(18)+1
		else
		if(value.lt.9.0) then
			freq(19)=freq(19)+1
		else
		if(value.lt.9.5) then
			freq(20)=freq(20)+1
		else
		if(value.lt.10.0) then
			freq(21)=freq(21)+1
		else
			freq(22)=freq(22)+1
		end if			
		end if
		end if
		end if
		end if
		end if
		end if
		end if
		end if
		end if
		end if
		end if
		end if
		end if
		end if
		end if
		end if
		end if
		end if
		end if
		end if
 99		continue
	end do
	end do
	end do
	mean=sum/nd
	var=sumsq/nd+mean*mean
	write(*,*) 'mean      = ',mean
	write(*,*) 'variance  = ',var
	write(*,*) 'num. data = ',nd
	write(2,*) 'Probabilities for classes'
	write(2,*) '2'
	write(2,*) 'Value Class'
	write(2,*) 'Frequency'
	do i=1,22
		class=(i-1)*0.5-0.25
		write(2,*)class,freq(i)
	end do
	close(1)
	close(2)
	end		
