import Control.Monad
import Control.Applicative
import Data.List

main = do
  xs <- (map read . lines) <$> getContents :: IO [Int]
  mapM_ print $ map pnsz xs

pnsz :: Int -> Int
pnsz n = length $ takeWhile (<= n) pn

pn = 2 : f [3,5..999999]
  where f (p:ps) = p : f [x | x <- ps, x `mod` p /= 0]