import Data.Functor

main = do
  n <- getRows <$> getContents
  mapM_ print $ map (\x -> length $ takeWhile (<= x) primes') n


getRows s = map (read :: (String -> Int)) $ lines s

primes' :: Integral a => [a]
primes' = 2 : filter isPrime' [3,5..]

isPrime' :: Integral a => a -> Bool
isPrime' x
    | x > 1 = all ((0 /=) . mod x) $ takeWhile ((<= x) . (^ 2)) primes'
        | otherwise = False