-- noch nicht fertig

import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import Data.List (sort, group)
import qualified Data.Vector.Unboxed as VU

main :: IO ()
main = do
  let
    sieve :: Int -> [(Int, Bool)] -> VU.Vector Bool
    sieve m = VU.accum (flip const) (VU.replicate m True) . map (flip (,) False) . concatMap f
      where
        f :: (Int, Bool) -> [Int]
        f (k, True) = map (k *) [2..(pred m `div` k)]
        f (k, _)    = map (k *) [1..(pred m `div` k)]
  n <- unsafeTextToInt <$> T.getLine :: IO Int
  as <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    v = sieve (succ $ 10 ^ 6) . map ((,) <$> head <*> (== 1) . length) . group . sort $ as :: VU.Vector Bool
  print . length . filter (v VU.!) $ as

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}
