isPrime :: Int -> Bool
isPrime 1 = False
isPrime 2 = True
isPrime n
    | mod n 2 == 0 = False
    | otherwise    = isnotDividable n 3
    where
        isnotDividable :: Int -> Int -> Bool
        isnotDividable n k
            | k * k > n    = True
            | mod n k == 0 = False
            | otherwise    = isnotDividable n $ k + 2

primes :: Int -> Int
primes n = length [p | p <- [1 .. n], isPrime p]

main :: IO ()
main = putStr . unlines . map show . map primes . map read . lines =<< getContents