N = int(eval(input()))

A = list(map(int, input().split()))

A.sort()

A.reverse()

flag = 0

result = [0, 0]



while len(A) >= 2 and flag < 2:

    N = A.pop(0)

    if N == A[0]:

        result[flag] = N

        del A[0]

        flag += 1



print((result[0]*result[1]))

import collections



N = int(eval(input()))

A = list(map(int, input().split()))

a = collections.Counter(A)

array = [0, 0]



for i in a:

    if a[i] >= 4:

        array += [i, i]

    elif a[i] >= 2:

        array.append(i)



array.sort()

array.reverse()

print((array[0]*array[1]))

N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
A.reverse()
flag = 0
result = [0, 0]
while len(A) >= 2 and flag < 2:
    N = A.pop(0)
    if N == A[0]:
        result[flag] = N
        del A[0]
        flag += 1
print((result[0] * result[1]))

import collections

N = int(eval(input()))
A = list(map(int, input().split()))
a = collections.Counter(A)
array = [0, 0]
for i in a:
    if a[i] >= 4:
        array += [i, i]
    elif a[i] >= 2:
        array.append(i)
array.sort()
array.reverse()
print((array[0] * array[1]))

+import collections + -A.sort() -A.reverse() -flag = 0 -result = [0, 0] -while len(A) >= 2 and flag < 2: -    N = A.pop(0) -    if N == A[0]: -        result[flag] = N -        del A[0] -        flag += 1 -print((result[0] * result[1])) +a = collections.Counter(A) +array = [0, 0] +for i in a: +    if a[i] >= 4: +        array += [i, i] +    elif a[i] >= 2: +        array.append(i) +array.sort() +array.reverse() +print((array[0] * array[1]))