#Uses python3

n = int(input())
a = [int(x) for x in input().split()]
assert(len(a) == n)

result = 0

max_index1 = -1;
for i in range(0,n):
	if ((max_index1 == -1) or (a[i] > a[max_index1])):
		max_index1 = i;

max_index2 = -1;
for j in range(0,n):
	if (a[j] != a[max_index1]) and ((max_index2 == -1) or (a[j] > a[max_index2])):
		max_index2 = j;

print(a[max_index1] * a[max_index2])
0800f136fc2bb6a3899e03b54ff4fc77cb53f4b0
<mask token>

<mask token>
assert len(a) == n
<mask token>
for i in range(0, n):
    if max_index1 == -1 or a[i] > a[max_index1]:
        max_index1 = i
<mask token>
for j in range(0, n):
    if a[j] != a[max_index1] and (max_index2 == -1 or a[j] > a[max_index2]):
        max_index2 = j
print(a[max_index1] * a[max_index2])

n = int(input())
a = [int(x) for x in input().split()]
assert len(a) == n
result = 0
max_index1 = -1
for i in range(0, n):
    if max_index1 == -1 or a[i] > a[max_index1]:
        max_index1 = i
max_index2 = -1
for j in range(0, n):
    if a[j] != a[max_index1] and (max_index2 == -1 or a[j] > a[max_index2]):
        max_index2 = j
print(a[max_index1] * a[max_index2])

#Uses python3

n = int(input())
a = [int(x) for x in input().split()]
assert(len(a) == n)

result = 0

max_index1 = -1;
for i in range(0,n):
	if ((max_index1 == -1) or (a[i] > a[max_index1])):
		max_index1 = i;

max_index2 = -1;
for j in range(0,n):
	if (a[j] != a[max_index1]) and ((max_index2 == -1) or (a[j] > a[max_index2])):
		max_index2 = j;

print(a[max_index1] * a[max_index2])