import Data.Set(Set, toList, fromList, findMax, delete)
main = do
    ns <- fmap (map read . lines) getContents :: IO [Integer]
    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 [2*p,3*p..q]  
     where q = findMax xs  