import Data.Set (Set, toList, fromList, findMax, foldl', delete)
import Control.Applicative
main = do
    ns <- map (read :: String -> Integer) . words <$> getContents
    mapM_ putStrLn $ map primeslen ns

primeslen :: Integer -> String
primeslen n = show . length $ primes [2..n]

primes :: [Integer] -> [Integer]
primes = toList . (seive 2) . fromList

seive :: Integer -> Set Integer -> Set Integer
seive p xs
     | p*p > findMax xs = xs
     | otherwise        = seive (p+1) $ foldl' (\acc x -> delete x acc) xs (fromList [2*p,3*p..q])
     where q = findMax xs