{-# LANGUAGE FlexibleContexts #-}

import Data.Array.ST
import Data.Array.Unboxed
import Data.Array.Base (unsafeRead, unsafeWrite)
import Control.Monad

shive :: Int -> UArray Int Bool
shive n = runSTUArray $ do
  arr <- newArray (0,n) True
  mapM_ (setFalse arr) $ [0,1] ++ [4 , 6 .. n]
  mapM_ (loop arr) [3, 5 .. truncate $ sqrt $ fromIntegral n]
  return arr
    where
      loop arr k = do
        v <- unsafeRead arr k
        when v $ mapM_ (setFalse arr) [k * k, k * (k + 2) .. n]
      setFalse arr k = unsafeWrite arr k False


primeList :: Int -> [Int]
primeList n = [p | (p, bool) <- assocs $ shive n, bool]

main = do
  n' <- getContents
  let n = map read $ lines n'
  putStr $ unlines $ map show $ map (length . primeList) n