type Table = ([Int],[Int],[Int])
fst3 (x,_,_) = x
primes :: [Int]
primes = concatMap fst3 $ iterate sieve ([],[2],[2..])
sieve :: Table -> Table
sieve (ps,q:qs,ss)
  = let (xs,ys) = span (q*q >) ss
    in (xs,qs++xs,filter ((/= 0) . (`mod` q)) ys)

main = getContents >>= mapM_ print . map (\n -> length $ takeWhile (<=n) primes) . map read . words