-- | Main entry point to the application.
module Main where

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

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

-- | The main entry point.
main :: IO ()
main = do
    _ <- getLine
    ns <- concatMap (fmap (read :: String -> Int) . words) . lines <$> getContents
    let primes = filter isPrime (nub ns)
    putStrLn . show $ length primes