let n = Scanf.scanf " %d" (+) 0
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let c, p, m, i = ref 0, ref a_s.(0), ref 0, ref 0
let f d = Printf.printf "%d\n" d; exit 0
let g i a = if i = 1 then f @@ !m * a else m := a
let _ = Array.(sort (fun x y -> y - x) a_s; iter (fun a -> if a = !p then (incr c; if !c >= 4 then f @@ a * a) else (if !c >= 2 then (g !i !p; incr i); c := 1; p := a)) a_s); if !c >= 2 then g !i !p; f 0