Scanf.scanf "%d" (fun n ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in
    Array.sort compare a;
    let hist = Array.make 1000001 0 in
    Array.iter (fun v -> hist.(v) <- hist.(v) + 1) a;
    let rec loop_i i acc =
        let rec loop_j v j acc =
            if j * j > v then acc else
                if v mod j <> 0 then loop_j v (j + 1) acc else (
                    let j1 = j in
                    let j2 = v / j in
                    if v <> j1 && hist.(j1) > 0 then acc - 1 else
                    if v <> j2 && hist.(j2) > 0 then acc - 1 else
                    if v = j1 && hist.(j1) > 1 then acc - 1 else
                    if v = j2 && hist.(j2) > 1 then acc - 1 else
                    if hist.(j1) = 0 && hist.(j2) = 0 then loop_j v (j + 1) acc else
                    if v = j1 && hist.(j1) = 1 || v = j2 && hist.(j2) = 1 then loop_j v (v + 1) acc
                    else acc - 1
                )
        in
        if i = n then acc else
            loop_i (i + 1) (loop_j a.(i) 1 acc)
    in
    loop_i 0 n |> Printf.printf "%d\n"
)