numOfPrimes :: Int -> Int
numOfPrimes 1 = 0
numOfPrimes n = length $ sieve [2 .. n]
    where
        sieve :: [Int] -> [Int]
        sieve [k] = [k]
        sieve (k:ks) = k : sieve ([l | l <- ks, k * k > l || mod l k /= 0])

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