import           Control.Applicative
import           Control.Monad
import           Data.List
import           Text.Printf

helpMod::Integer->Integer->Integer->Integer
helpMod a d n= fun a d where
    fun a 1 = mod a n
    fun a 2 = mod (a^2) n
    fun a d = let
            p=fun (mod (a^2) n) (div d 2)
            q=if odd d then mod (a*p) n else p
          in mod q n

isProbable::Integer-> Bool
isProbable n |n<=1 = False
         |n==2 = True
         |even n = False
         |otherwise = rabinMiller [2,3,5,7,11,13,17,19] n s d where
             d=until (\x->mod x 2/=0) (`div` 2) (n-1) --(n-1=2^s*d)
             s=until (\x->d*2^x==pred n) (+1) 0  --counts the power


rabinMiller::[Integer]->Integer->Integer->Integer-> Bool
rabinMiller [] _ _ _ = True
rabinMiller (a:xs) n s d =  if a == n then True
                 else  case x==1 of
                    True -> rabinMiller xs n s d
                    _ -> if any ( ==pred n) $ take (fromIntegral s) $ iterate (\e->mod (e^2) n)  x then rabinMiller xs n s d
                          else  False
                   where x=helpMod a d n
main = do
    n<-getLine
    a<- replicateM (read n) getLine
    print $ length $ filter isProbable (map (read::String->Integer) a)
