We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.
# encoding: utf-8
N = int(input())
A = list(map(int, input().split()))

A.sort()

view = -1
lengths = []
cnt = 0
for Ai in reversed(A):
    if Ai > view:
        view = Ai
        cnt = 0
    cnt += 1
    if cnt >= 2:
        lengths.append(Ai)
        cnt = 0
    if len(lengths) > 1: break

print(lengths[-1] * lengths[-2] if len(lengths) > 1 else 0)
# encoding: utf-8
N = int(input())
A = list(map(int, input().split()))

A.sort()

view = 10 ** 9 + 7
lengths = [0] * 2
idx = 0
for Ai in reversed(A):
    if Ai < view:
        view = Ai
        cnt = 0
    cnt += 1
    if cnt >= 2:
        lengths[idx] = view
        cnt = 0
        idx += 1
    if idx > 1: break


print(lengths[0] * lengths[1] if idx > 1 else 0)