module Main (main) where
import Data.Function
import Control.Monad
import System.IO
--import Data.Vector
minus (x:xs) (y:ys) = case (compare x y) of
           LT -> x : minus  xs  (y:ys)
           EQ ->     minus  xs     ys
           GT ->     minus (x:xs)  ys
minus  xs     _     = xs
union (x:xs) (y:ys) = case (compare x y) of
           LT -> x : union  xs  (y:ys)
           EQ -> x : union  xs     ys
           GT -> y : union (x:xs)  ys
union  xs     []    = xs
union  []     ys    = ys

primesTo m = eratos [2..m]  where        -- bounded, up to m
   eratos []     = []
   eratos (p:xs) = p : eratos (xs `minus` [p,p+p..])


main :: IO ()
main = do
     fix $ \loop -> do
       eof <- isEOF
       unless eof $ do
         n <- readLn :: IO Int
         print $ length . takeWhile (<=n) $ primesTo 1000000
         loop