main = getContents >>= mapM_ (print . solve . read) . lines

solve n = length $ takeWhile (<= n) ps
    where ps = primes [2..999999]

primes [] = []
primes (x:xs) = x : primes [y | y <- xs, x*x > y || y `mod` x /= 0]