open Str

let read_list f =
  split (regexp " +") (read_line ()) |> List.map f

let flip f x y = f y x
                   
let () =
  let _ = read_int () in
  let lst = read_list int_of_string |> List.sort (flip compare) in
  let rec iter e = function
      x :: y :: ys when x = y -> if e = 0 then iter x ys else e * x
    | x :: xs -> iter e xs
    | _ -> 0 in
  iter 0 lst |> string_of_int |> print_endline
