import Data.Ix(range)

main :: IO()
main = getContents >>= mapM_ (print . length . filter isPrime . range . ((,) 2)) . (map read . lines)

isPrime :: Int -> Bool
isPrime 2 = True
isPrime n
    | n < 2           = False
    | n `mod` 2 == 0  = False
    | otherwise       = testDiv 3 n
    where testDiv :: Int -> Int -> Bool
          testDiv i n
              | i * i > n      = True
              | n `mod` i == 0 = False
              | otherwise      = testDiv (i + 2) n
