primes :: Int -> [Int] -> Int ->  Int -> Int
primes i l n a | i > n = length l + a
               | otherwise = primes next res n (a+1)
                  where res = filter (\x -> x`mod`i /= 0) l
                        next = head res


primeNumber :: Int -> Int
primeNumber n = primes 2 [2..n] l 0
  where l = ceiling . sqrt . realToFrac $ n

main = interact (unlines . map (show . primeNumber . read) . lines)