import collections



N = int(eval(input()))

A = [int(i) for i in input().split()]



stick_num = collections.Counter(A)

flag = True

ans = 0

for i in sorted(stick_num, reverse=True):

    if stick_num[i] >= 4:

        ans = i * i if flag else a * i

        break

    elif stick_num[i] >= 2:

        if flag:

            a = i

            flag = False

        else:

            ans = a * i

            break



print(ans)
N = int(eval(input()))

A = [int(i) for i in input().split()]

A.sort(reverse=True)



flag_h = True

flag_v = True

h, v = 0, 0



for i in A:

    if flag_h:

        if h == i:

            flag_h = False

        else:

            h = i

    elif flag_v:

        if v == i:

            flag_v = False

        else:

            v = i



if not (flag_v and flag_h):

    print((h * v))

else:

    print((0))
import collections

N = int(eval(input()))
A = [int(i) for i in input().split()]
stick_num = collections.Counter(A)
flag = True
ans = 0
for i in sorted(stick_num, reverse=True):
    if stick_num[i] >= 4:
        ans = i * i if flag else a * i
        break
    elif stick_num[i] >= 2:
        if flag:
            a = i
            flag = False
        else:
            ans = a * i
            break
print(ans)

N = int(eval(input()))
A = [int(i) for i in input().split()]
A.sort(reverse=True)
flag_h = True
flag_v = True
h, v = 0, 0
for i in A:
    if flag_h:
        if h == i:
            flag_h = False
        else:
            h = i
    elif flag_v:
        if v == i:
            flag_v = False
        else:
            v = i
if not (flag_v and flag_h):
    print((h * v))
else:
    print((0))

-import collections - -stick_num = collections.Counter(A) -flag = True -ans = 0 -for i in sorted(stick_num, reverse=True): -    if stick_num[i] >= 4: -        ans = i * i if flag else a * i -        break -    elif stick_num[i] >= 2: -        if flag: -            a = i -            flag = False +A.sort(reverse=True) +flag_h = True +flag_v = True +h, v = 0, 0 +for i in A: +    if flag_h: +        if h == i: +            flag_h = False -            ans = a * i -            break -print(ans) +            h = i +    elif flag_v: +        if v == i: +            flag_v = False +        else: +            v = i +if not (flag_v and flag_h): +    print((h * v)) +else: +    print((0))