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 :: xs -> 
    if devideable 1 x then loop ans xs
    else begin
      vs.(x) <- true;
      loop (ans + 1) xs
    end


let () = 
  let hd = List.hd a in
  if List.for_all ((=) hd) a then print_endline "0"
  else loop 0 a
