import collections



N = int(eval(input()))

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



CA = collections.Counter(A)



max1 = 0

max2 = 0

for item in list(CA.items()):

    if item[1] >= 2 and item[0] > max1:

        if item[1] >= 4:

            max1 = item[0]

            max2 = item[0]

        else:

            max2 = max1

            max1 = item[0]

    elif item[1] >= 2 and item[0] > max2:

        max2 = item[0]

print((max1*max2))

import collections



N = int(eval(input()))

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



c = collections.Counter(A)

max_1 = 0

max_2 = 0

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

    if v >= 2:

        if k > max_1:

            if v >= 4:

                max_1, max_2 = k, k

            else:

                max_1, max_2 = k, max_1

        elif k > max_2:

            max_2 = k



print((max_1*max_2))

import collections

N = int(eval(input()))
A = list(map(int, input().split()))
CA = collections.Counter(A)
max1 = 0
max2 = 0
for item in list(CA.items()):
    if item[1] >= 2 and item[0] > max1:
        if item[1] >= 4:
            max1 = item[0]
            max2 = item[0]
        else:
            max2 = max1
            max1 = item[0]
    elif item[1] >= 2 and item[0] > max2:
        max2 = item[0]
print((max1 * max2))

import collections

N = int(eval(input()))
A = list(map(int, input().split()))
c = collections.Counter(A)
max_1 = 0
max_2 = 0
for k, v in list(c.items()):
    if v >= 2:
        if k > max_1:
            if v >= 4:
                max_1, max_2 = k, k
            else:
                max_1, max_2 = k, max_1
        elif k > max_2:
            max_2 = k
print((max_1 * max_2))

-CA = collections.Counter(A) -max1 = 0 -max2 = 0 -for item in list(CA.items()): -    if item[1] >= 2 and item[0] > max1: -        if item[1] >= 4: -            max1 = item[0] -            max2 = item[0] -        else: -            max2 = max1 -            max1 = item[0] -    elif item[1] >= 2 and item[0] > max2: -        max2 = item[0] -print((max1 * max2)) +c = collections.Counter(A) +max_1 = 0 +max_2 = 0 +for k, v in list(c.items()): +    if v >= 2: +        if k > max_1: +            if v >= 4: +                max_1, max_2 = k, k +            else: +                max_1, max_2 = k, max_1 +        elif k > max_2: +            max_2 = k +print((max_1 * max_2))