n = int(input())
a = list(map(int, input().split()))
a.sort()
max = -float('inf')
for i in range(n):
for j in range(i+1, n):
f = a[i] * a[j]
if f >= max:
max = f
print(max)
biA9IGludChpbnB1dCgpKQphID0gbGlzdChtYXAoaW50LCBpbnB1dCgpLnNwbGl0KCkpKQphLnNvcnQoKQptYXggPSAtZmxvYXQoJ2luZicpCmZvciBpIGluIHJhbmdlKG4pOgogICAgZm9yIGogaW4gcmFuZ2UoaSsxLCBuKToKICAgICAgICBmID0gYVtpXSAqIGFbal0KICAgICAgICBpZiBmID49IG1heDoKICAgICAgICAgICAgbWF4ID0gZgpwcmludChtYXgpCg==