isPrime x = and $ map (not . divisible x) divisors
  where divisible a b = a `mod` b == 0
        divisors = takeWhile (\d -> d * d <= x) [2..]

primesUnder n = filter isPrime [2..n]

main = do
  s <- getContents
  putStr . unlines . map eachline . lines $ s
  where
    eachline = show . length . primesUnder . read