n=int(eval(input()))

b=sorted([int(i) for i in input().split()],reverse=True)

def groupby(a):

    a2=[[a[0],1]]

    for i in range(1,len(a)):

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

            a2[-1][1]+=1

        else:

            a2.append([a[i],1])

    return a2

A=groupby(b)

l=len(A)

B=[]

for i in range(l):

    A[i][1]=min(A[i][1]//2,2)

    if A[i][1]!=0:

        B.append(A[i])



l=len(B)

if l==0:

    print((0))

elif l==1:

    if B[0][1]==1:

        print((0))

    else:

        print((B[0][0]**2))

else:

    if B[0][1]==2:

        print((B[0][0]**2))

    else:

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

n=int(eval(input()))

a=sorted(list(map(int,input().split())),reverse=True)

x,y=0,0

def groupby(a):

    a2=[[a[0],1]]

    for i in range(1,len(a)):

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

            a2[-1][1]+=1

        else:

            a2.append([a[i],1])

    return a2

b=groupby(a)

l=len(b)

for i in range(l):

    if x==0:

        if b[i][1]>=4:

            x,y=b[i][0],b[i][0]

        elif b[i][1]>=2:

            x=b[i][0]

    elif y==0:

        if b[i][1]>=2:

            y=b[i][0]

    else:

        break

print((x*y))

n = int(eval(input()))
b = sorted([int(i) for i in input().split()], reverse=True)


def groupby(a):
    a2 = [[a[0], 1]]
    for i in range(1, len(a)):
        if a2[-1][0] == a[i]:
            a2[-1][1] += 1
        else:
            a2.append([a[i], 1])
    return a2


A = groupby(b)
l = len(A)
B = []
for i in range(l):
    A[i][1] = min(A[i][1] // 2, 2)
    if A[i][1] != 0:
        B.append(A[i])
l = len(B)
if l == 0:
    print((0))
elif l == 1:
    if B[0][1] == 1:
        print((0))
    else:
        print((B[0][0] ** 2))
else:
    if B[0][1] == 2:
        print((B[0][0] ** 2))
    else:
        print((B[0][0] * B[1][0]))

n = int(eval(input()))
a = sorted(list(map(int, input().split())), reverse=True)
x, y = 0, 0


def groupby(a):
    a2 = [[a[0], 1]]
    for i in range(1, len(a)):
        if a2[-1][0] == a[i]:
            a2[-1][1] += 1
        else:
            a2.append([a[i], 1])
    return a2


b = groupby(a)
l = len(b)
for i in range(l):
    if x == 0:
        if b[i][1] >= 4:
            x, y = b[i][0], b[i][0]
        elif b[i][1] >= 2:
            x = b[i][0]
    elif y == 0:
        if b[i][1] >= 2:
            y = b[i][0]
    else:
        break
print((x * y))

-b = sorted([int(i) for i in input().split()], reverse=True) +a = sorted(list(map(int, input().split())), reverse=True) +x, y = 0, 0 -A = groupby(b) -l = len(A) -B = [] +b = groupby(a) +l = len(b) -    A[i][1] = min(A[i][1] // 2, 2) -    if A[i][1] != 0: -        B.append(A[i]) -l = len(B) -if l == 0: -    print((0)) -elif l == 1: -    if B[0][1] == 1: -        print((0)) +    if x == 0: +        if b[i][1] >= 4: +            x, y = b[i][0], b[i][0] +        elif b[i][1] >= 2: +            x = b[i][0] +    elif y == 0: +        if b[i][1] >= 2: +            y = b[i][0] -        print((B[0][0] ** 2)) -else: -    if B[0][1] == 2: -        print((B[0][0] ** 2)) -    else: -        print((B[0][0] * B[1][0])) +        break +print((x * y))