module Main where

import Debug.Trace
import Data.List

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

answer :: [Int] -> Int
answer s = length $ solve (mymerge a1 a2)
  where
    s' = sort s
    (s1, s2) = mysplit s'
    a1 = solve s1
    a2 = solve s2

mysplit :: [a] -> ([a], [a])
mysplit s = mysplit' ([], []) s 
  where
    mysplit' (a, b) (s:ss) = mysplit' (s:b, a) ss
    mysplit' (a, b) [] = (a, b)

mymerge ::  [Int] -> [Int] -> [Int]
mymerge sl@(s:ss) tl@(t:ts)
  | s < t     = s:(mymerge ss tl)
  | otherwise = t:(mymerge sl ts)
mymerge [] tl = tl
mymerge sl [] = sl

solve :: [Int] -> [Int]
solve s = parse . group $ sort s

parse :: [[Int]] -> [Int]
parse (s:ss)
  | length s > 1 = t
  | otherwise = s':t
  where
    t = parse . filter ((/= 0) . (`mod` s') . head) $ ss
    s' = head s

parse [] = []

