main = do
  s <- getContents
  let ss = filter (not . null) . lines $ s
  mapM_ (print . length . solve . read) ss

solve :: Integer -> [Integer]
solve x = takeWhile (<= x) primeNumbers 

primeNumbers :: [Integer]
primeNumbers = 2:f [3,5..] where f (x:xs) = x:f [y | y <- xs, mod y x /= 0]