primes :: Int -> [Int]
primes n = 2:impl [3,5..n]
    where
        impl [] = []
        impl (x:xs) = x : impl [y | y <- xs , x * x > y || mod y x /= 0]

main :: IO ()
main = do
    nyan <- getContents :: IO String
    ns <- return $ map read $ lines nyan
    mapM_ (print . length . primes) ns