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 =
            let check c =
                if hist.(c) = 0 then true else
                    if v <> c then false else
                        if hist.(c) = 1 then true else false
            in
            if j * j > v then acc else
                if v mod j <> 0 then loop_j v (j + 1) acc else
                if check j && check (v / j) then loop_j v (j + 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"
)