n = int(eval(input()))

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

a.sort(reverse=True)

ans=[]

i=0

while i<n-1:

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

        ans.append(a[i])

        i+=1

    i+=1

if len(ans) >= 2:

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

else:

    print((0))
n = int(eval(input()))

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

a.sort(reverse=True)

flag=True

for i in range(0,n-4+1):

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

        for j in range(i+2,n-1+1):

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

                print((a[i]*a[j]))

                flag=False

                break

        break

if flag:

    print((0))

n = int(eval(input()))
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = []
i = 0
while i < n - 1:
    if a[i] == a[i + 1]:
        ans.append(a[i])
        i += 1
    i += 1
if len(ans) >= 2:
    print((ans[0] * ans[1]))
else:
    print((0))

n = int(eval(input()))
a = list(map(int, input().split()))
a.sort(reverse=True)
flag = True
for i in range(0, n - 4 + 1):
    if a[i] == a[i + 1]:
        for j in range(i + 2, n - 1 + 1):
            if a[j] == a[j + 1]:
                print((a[i] * a[j]))
                flag = False
                break
        break
if flag:
    print((0))

-ans = [] -i = 0 -while i < n - 1: +flag = True +for i in range(0, n - 4 + 1): -        ans.append(a[i]) -        i += 1 -    i += 1 -if len(ans) >= 2: -    print((ans[0] * ans[1])) -else: +        for j in range(i + 2, n - 1 + 1): +            if a[j] == a[j + 1]: +                print((a[i] * a[j])) +                flag = False +                break +        break +if flag: