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

solve :: Integer -> [Integer]
solve x = primeNumbers x [2..x] []

primeNumbers :: Integer -> [Integer] -> [Integer] -> [Integer]
primeNumbers x lst primes
  | fromInteger headNum > sqrt (fromInteger x) = reverse primes ++ lst
  | otherwise = primeNumbers x (filter (\a -> a `rem` headNum /= 0) lst) (headNum:primes)
    where headNum = head lst