n = int(eval(input()))

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

a.sort()

f,s,i = 0,0,0

while i+1<n:

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

        s = f

        f = a[i]

        i += 1

    i += 1

print((f*s))

ai = lambda: list(map(int, input().split()))



n = int(eval(input()))

a = ai()

from collections import Counter

c = Counter(a)

a = [i for i in c if c[i]>1]

a.sort()

if len(a)>0 and c[a[-1]]>=4:

    print((a[-1]**2))

elif len(a)<2:

    print((0))

else:

    print((a[-1]*a[-2]))
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
f, s, i = 0, 0, 0
while i + 1 < n:
    if a[i] == a[i + 1]:
        s = f
        f = a[i]
        i += 1
    i += 1
print((f * s))

ai = lambda: list(map(int, input().split()))
n = int(eval(input()))
a = ai()
from collections import Counter

c = Counter(a)
a = [i for i in c if c[i] > 1]
a.sort()
if len(a) > 0 and c[a[-1]] >= 4:
    print((a[-1] ** 2))
elif len(a) < 2:
    print((0))
else:
    print((a[-1] * a[-2]))

+ai = lambda: list(map(int, input().split())) -a = list(map(int, input().split())) +a = ai() +from collections import Counter + +c = Counter(a) +a = [i for i in c if c[i] > 1] -f, s, i = 0, 0, 0 -while i + 1 < n: -    if a[i] == a[i + 1]: -        s = f -        f = a[i] -        i += 1 -    i += 1 -print((f * s)) +if len(a) > 0 and c[a[-1]] >= 4: +    print((a[-1] ** 2)) +elif len(a) < 2: +    print((0)) +else: +    print((a[-1] * a[-2]))