N = int(eval(input()))

A = sorted(list(map(int,input().split())),reverse=True)



for i in range(N-1):

    if A[i]==A[i+1]:

        A[i+1]=0

    else:

        A[i]=0



A.sort(reverse=True)

print((A[0]*A[1]))
from collections import *

N = int(eval(input()))

C = Counter(list(map(int,input().split())))

A = [0,0]

B = [0]



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

  if 2<=v:

    A+=[k]

  if 4<=v:

    B+=[k]



A.sort()

B.sort()

print((max(A[-1]*A[-2],B[-1]**2)))
N = int(eval(input()))
A = sorted(list(map(int, input().split())), reverse=True)
for i in range(N - 1):
    if A[i] == A[i + 1]:
        A[i + 1] = 0
    else:
        A[i] = 0
A.sort(reverse=True)
print((A[0] * A[1]))

from collections import *

N = int(eval(input()))
C = Counter(list(map(int, input().split())))
A = [0, 0]
B = [0]
for k, v in list(C.items()):
    if 2 <= v:
        A += [k]
    if 4 <= v:
        B += [k]
A.sort()
B.sort()
print((max(A[-1] * A[-2], B[-1] ** 2)))

+from collections import * + -A = sorted(list(map(int, input().split())), reverse=True) -for i in range(N - 1): -    if A[i] == A[i + 1]: -        A[i + 1] = 0 -    else: -        A[i] = 0 -A.sort(reverse=True) -print((A[0] * A[1])) +C = Counter(list(map(int, input().split()))) +A = [0, 0] +B = [0] +for k, v in list(C.items()): +    if 2 <= v: +        A += [k] +    if 4 <= v: +        B += [k] +A.sort() +B.sort() +print((max(A[-1] * A[-2], B[-1] ** 2)))