import Data.Functor( (<$>))
import Control.Monad( replicateM)

main = do
    n <- read <$> getLine
    is <- replicateM n (read <$> getLine)   ::IO [Int]
    let
	primes (i, ps) limit
	    |	limit < i = ps	::[Int]
	    |	otherwise = let
				stop = floor . sqrt . fromIntegral $ i
				candidate = dropWhile (> stop) ps
			    in
				if and $ ( (0/=) . (i`rem`)) <$> candidate
				then primes (i+2, i:ps) limit
				else primes (i+2, ps) limit

	primeTable = reverse $ primes (5,[3,2]) 10000
	
	isPrime i
	  = let
		stop = floor . sqrt . fromIntegral $ i
		checkList = takeWhile (<=stop) primeTable
	    in
		and $ ( (0/=) . (i`rem`)) <$> checkList

    print . length $ filter isPrime is

