import Control.Monad

primes :: Integral a => [a]
primes = 2 : [n | n <- [3..], all ((/=0).mod n) $ takeWhile ((<=n).(^2)) primes]

primesIn :: Integral a => [a] -> [a]
primesIn ns = [n | n <- ns, all ((/=0).mod n) primes']
  where maxn = maximum ns
        primes' = takeWhile ((<=maxn).(^2)) primes

main :: IO ()
main = do
  n <- readLn
  ns <- replicateM n readLn
  print $ length $ primesIn ns