import Control.Applicative
import Data.List

main = do
  contents <- fmap (read :: String -> Int) . lines <$> getContents
  let primes = seive [2..999999] 999999
  mapM_ (solve primes) contents

seive :: [Int] -> Int -> [Int]
seive [] _ = []
seive all@(x:xs) n
  | x^2 > n = all
  | otherwise = x : (seive [a | a <- xs, mod a x > 0] n)

solve :: [Int] -> Int -> IO ()
solve primes n = putStrLn $ show $ length $ takeWhile (<= n) primes