isPrime x = and $ map (not . divisible x) [2..(x-1)]
  where divisible a b = a `mod` b == 0

primesUnder n = filter isPrime [2..n]
  -- Note: this function is not efficient (O(n^2))

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