import Control.Monad

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

primesIn :: Integral a => [a] -> [a]
primesIn ns = filter ((flip elem) primes') ns
  where maxn = maximum ns
        primes' = takeWhile (<=maxn) primes

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