from collections import Counter as C



_ = eval(input())

a = C([int(x) for x in input().split()])



b = []

for k, v in list(a.items()):

    for _ in range(v // 2):

        b.append(k)

else:

    if 2 <= len(b):

        b.sort()

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

    else:

        print((0))
from collections import Counter as C



_ = eval(input())



b = []

for k, v in list(C([int(x) for x in input().split()]).items()):

    b.extend([k] * (v // 2))

else:

    if 2 <= len(b):

        b.sort()

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

    else:

        print((0))
from collections import Counter as C

_ = eval(input())
a = C([int(x) for x in input().split()])
b = []
for k, v in list(a.items()):
    for _ in range(v // 2):
        b.append(k)
else:
    if 2 <= len(b):
        b.sort()
        print((b[-1] * b[-2]))
    else:
        print((0))

from collections import Counter as C

_ = eval(input())
b = []
for k, v in list(C([int(x) for x in input().split()]).items()):
    b.extend([k] * (v // 2))
else:
    if 2 <= len(b):
        b.sort()
        print((b[-1] * b[-2]))
    else:
        print((0))

-a = C([int(x) for x in input().split()]) -for k, v in list(a.items()): -    for _ in range(v // 2): -        b.append(k) +for k, v in list(C([int(x) for x in input().split()]).items()): +    b.extend([k] * (v // 2))