import Control.Monad

main :: IO ()
main = do
  n <- readLn
  ns <- replicateM n readLn
  print $ length $ filter isPrime ns
    where
      isPrime n = all ((/=0).mod n) (primes' n)
      primes' n = takeWhile ((<=n).(^2)) primes
      primes = 2 : filter isPrime [3..]