# -*- coding: utf-8 -*-



from collections import Counter



n = int(eval(input()))

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



c = Counter(a)

li = sorted(list(c.items()), key=lambda x: x[0], reverse=True)



cands = []

for num, cnt in li:

    if cnt >= 4:

        cands += [num, num]

    elif cnt >= 2:

        cands += [num]



cands += [0, 0]

ans = cands[0] * cands[1]

print(ans)

# -*- coding: utf-8 -*-



from collections import Counter



n = int(eval(input()))

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



pair = [0, 0]

c = Counter(a)

for num, cnt in list(c.items()):

    pair += [num] * (cnt // 2)



pair.sort(reverse=True)



ans = pair[0] * pair[1]

print(ans)

# -*- coding: utf-8 -*-
from collections import Counter

n = int(eval(input()))
a = list(map(int, input().split()))
c = Counter(a)
li = sorted(list(c.items()), key=lambda x: x[0], reverse=True)
cands = []
for num, cnt in li:
    if cnt >= 4:
        cands += [num, num]
    elif cnt >= 2:
        cands += [num]
cands += [0, 0]
ans = cands[0] * cands[1]
print(ans)

# -*- coding: utf-8 -*-
from collections import Counter

n = int(eval(input()))
a = list(map(int, input().split()))
pair = [0, 0]
c = Counter(a)
for num, cnt in list(c.items()):
    pair += [num] * (cnt // 2)
pair.sort(reverse=True)
ans = pair[0] * pair[1]
print(ans)

+pair = [0, 0] -li = sorted(list(c.items()), key=lambda x: x[0], reverse=True) -cands = [] -for num, cnt in li: -    if cnt >= 4: -        cands += [num, num] -    elif cnt >= 2: -        cands += [num] -cands += [0, 0] -ans = cands[0] * cands[1] +for num, cnt in list(c.items()): +    pair += [num] * (cnt // 2) +pair.sort(reverse=True) +ans = pair[0] * pair[1]