import Data.Array
import Data.List

main = do
  getLine
  ns <- sort . map read . words <$> getLine :: IO [Int]
  print $ solve ns

solve ns = length . filter ((==1) . (cs!)) $ step [] ns'
  where
    ns' = map head $ group ns
    cs = accumArray (+) 0 (1, 10^6) $ zip ns (repeat 1)
    step ps [] = ps
    step [] (q:qs) = step [q] qs
    step (p:ps) qs = p : step (ps++ps') qs'
      where
        (ps', qs') = span (<p*2) (filter ((/=0) . (`mod`p)) qs)