local n = io.read("*n")
local a = {}
for i = 1, n do a[i] = io.read("*n") end
table.sort(a, function(x, y) return x > y end)
local c = {}
local found = 0
local pos = 1
local len = #a
while(pos < len) do
  if(a[pos] == a[pos + 1]) then
    found = found + 1
    c[found] = a[pos]
    if(found == 2) then break end
    pos = pos + 2
  else
    pos = pos + 1
  end
end
if(found < 2) then print(0) else print(c[1] * c[2]) end
