{-# OPTIONS_GHC -Wall -Werror #-}

main :: IO ()
main = do
  nums <- map read <$> words <$> getContents
  mapM_ (\n -> print $ length $ takeWhile (<= n) primes) nums

-- http://itchyny.hatenablog.com/entry/2016/01/17/120000
primes :: [Integer]
primes = 2 : filter isPrime [3,5..]

isPrime :: Integer -> Bool
isPrime n = n > 1 && foldr (\x acc -> x * x > n || (n `mod` x /= 0 && acc)) True primes