import Control.Applicative
import Control.Monad

main :: IO ()
main = do
  ls <- map read . lines <$> getContents
  forM_ ls $ \n -> print $ length $ takeWhile (<=n) primes

primes :: [Int]
primes = 2:sieve [3] [3,5..]
  where
    sieve :: [Int] -> [Int] -> [Int]
    sieve (x:xs) ys = let
        (ps, qs) = span (<x^2) ys
      in ps ++ sieve (xs ++ ps) (filter ((/=0) . (`mod`x)) qs)