import Control.Applicative

main :: IO ()
main = do
    ns <- map read . lines <$> getContents
    print $ solve ns

solve :: [Int] -> Int
solve [] = 0
solve (x:xs) =
    if isPrime x
        then solve xs + 1
        else solve xs
    where
        primes = 2:3:[x|i<-[1..], j<-[-1,1], let x = 6*i+j, isPrime x]
        isPrime n = null [i|i<-takeWhile (\x -> x*x <= n) primes, rem n i == 0]