from collections import Counter as C



_ = eval(input())

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



b = [0] * 2

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

    if 4 <= v:

        b.append(k)

    if 2 <= v:

        b.append(k)

else:

    b.sort()

    print((b[-1] * b[-2]))
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()):

    if 4 <= v:

        b.append(k)

    if 2 <= v:

        b.append(k)

else:

    if len(b) <= 1:

        print((0))

    else:

        b.sort()

        print((b[-1] * b[-2]))
from collections import Counter as C

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

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()):
    if 4 <= v:
        b.append(k)
    if 2 <= v:
        b.append(k)
else:
    if len(b) <= 1:
        print((0))
    else:
        b.sort()
        print((b[-1] * b[-2]))

-b = [0] * 2 +b = [] -    b.sort() -    print((b[-1] * b[-2])) +    if len(b) <= 1: +        print((0)) +    else: +        b.sort() +        print((b[-1] * b[-2]))