main = let primes = sieve [2..]
            where sieve (p:xs) = p : sieve [x | x<-xs, (mod x p) /= 0]
        in getContents >>= mapM_ (putStrLn . fout . prime_number primes . fin) . lines
fin = read
fout = show 
prime_number ps n = length (takeWhile (<= n) ps)