{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE BangPatterns #-}

module Main where

import Debug.Trace
import Control.Monad

import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM

main :: IO ()
main = do
  getLine
  s <- map read . words <$> getLine 
  --a `traceShow`
  print $ solve s

solve :: [Int] -> Int
solve s = length . filter (\ss -> t U.! ss == 1) $ s
  where
    mx = (maximum s) + 1
    t = build mx s

build :: Int -> [Int] -> U.Vector Int
build mx ss = U.create $ do
  vec <- UM.replicate (mx + 1) 0
  forM_ ss $ \s -> do
    c <- UM.read vec s
    UM.modify vec (+ 1) s
    when (c < 1) $ do
      forM_ [s*2, s*3 .. mx] $ \t -> do
        UM.modify vec (+ 1) t
  return vec
