n,*a=list(map(int,open(0).read().split()))

a.sort(reverse=True)

for i in range(1,n):

    if a[i]==a[i-1]:

        a[i]=0

    else:

        a[i-1]=0

a.sort()

print((a[-1]*a[-2]))
n,*a=list(map(int,open(0).read().split()))

a.sort()

x,y,i=0,0,0

while i<n:

  if a[i-1]==a[i]:

    x,y=y,a[i]

    i+=1

  i+=1

print((x*y))
n, *a = list(map(int, open(0).read().split()))
a.sort(reverse=True)
for i in range(1, n):
    if a[i] == a[i - 1]:
        a[i] = 0
    else:
        a[i - 1] = 0
a.sort()
print((a[-1] * a[-2]))

n, *a = list(map(int, open(0).read().split()))
a.sort()
x, y, i = 0, 0, 0
while i < n:
    if a[i - 1] == a[i]:
        x, y = y, a[i]
        i += 1
    i += 1
print((x * y))

-a.sort(reverse=True) -for i in range(1, n): -    if a[i] == a[i - 1]: -        a[i] = 0 -    else: -        a[i - 1] = 0 -print((a[-1] * a[-2])) +x, y, i = 0, 0, 0 +while i < n: +    if a[i - 1] == a[i]: +        x, y = y, a[i] +        i += 1 +    i += 1 +print((x * y))