import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  xs <- inpi toInt
  mapM_ print $ solve xs

solve :: [Int] -> [Int]
solve = map npn

npn :: Int -> Int
npn n = length . takeWhile (<= n) $ pns

pns :: [Int]
pns = 2 : 3 : f 5 2
  where
    f x d
      | isPn x = x : f (x + d) (6 - d)
      | otherwise = f (x + d) (6 - d)

isPn :: Int -> Bool
isPn x = all ((/= 0) . mod x) $ takeWhile ((<= x) . (^2)) pns

toInt :: String -> Int
toInt s = read s

inpi :: (String -> a) -> IO [a]
inpi f = map f . lines <$> getContents