import Control.Monad
import Control.Applicative
import Data.Functor
import Data.List
import Data.Char

primes = primes' [2..]
  where
    primes' (p:l) = (p:primes' (filter ((/=0) . flip mod p) l))

primesLT1e4 = takeWhile (<10000) primes

isPrime x = elem x primesLT1e4 || null (filter ((/=0) . mod x) primesLT1e4)

readLn2 = readLn :: IO Int
main = do
  readLn2 >>= flip replicateM readLn2 >>= print . length . filter isPrime