import Control.Applicative

isPrime :: Int -> Int
isPrime n
  | n == 2         = 1
  | n `mod` 2 == 0 = 0
  | otherwise      = _isPrime 3 n
  where
        _isPrime :: Int -> Int -> Int
        _isPrime i n
          | i >  d    = 1
          | r == 0    = 0
          | otherwise = _isPrime (i+1) n
            where
                (d, r) = n `divMod` i

main :: IO ()
main = do
    n <- read <$> getLine :: IO Int
    c <- loop n
    print c
    where
        loop :: Int -> IO Int
        loop n
          | n == 0    = return 0
          | otherwise = do
              m <- read <$> getLine :: IO Int
              (+ (isPrime m)) <$> loop (n - 1)

