main = getContents >>= mapM_ (putStrLn . fout . prime_number primes . fin) . lines
fin = read
fout = show 
prime_number ps n = length (takeWhile (<= n) ps)
primes = filter isPrime [2..999999]
isPrime n = not $ any (\x -> mod n x == 0) [2..n-1]