let n = Scanf.scanf " %d" (+) 0
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let xs = Array.(sort (-) a_s; fold_left (fun (xs, p) a -> if p = a then a :: xs, 0 else xs, a) ([], 0) a_s) |> fst
let _ = Printf.printf "%d\n" @@ match xs with a :: b :: _ -> a * b | _ -> 0