let split_string ?(pattern="") = Str.split @@ Str.regexp pattern
let n = Scanf.sscanf (read_line ()) "%d" @@ fun n -> n
let a = read_line () |> split_string ~pattern:" " |> List.map int_of_string |> List.sort compare

let vs = Array.make 1_000_001 false

let rec devideable i x =
  if i * i > x then false
  else if x mod i <> 0 then devideable (i + 1) x
  else vs.(i) || vs.(x / i) || devideable (i + 1) x

let rec loop ans = function
  | [] -> Printf.printf "%d\n" ans
  | (x, cnt) :: xs ->
    let d = devideable 1 x in 
    vs.(x) <- true;
    if cnt > 1 || d then loop ans xs
    else loop (ans + 1) xs

let () = 
  let rec f = function
    | (acc, []) -> acc
    | ((v, cnt) :: accs as acc, x :: xs) ->
      if x = v then f ((v, cnt + 1) :: accs, xs)
      else f ((x, 1) :: acc, xs)
    | _ -> failwith ""
  in
  loop 0 (List.rev (f ([(List.hd a, 1)], List.tl a)))