import sys
input = sys.stdin.readline
n = int(input())
data = list(map(int, input().split()))
ans = min(data) * max(data)
print(ans)

0a57cd13dc7f26511bfc0f50428a4e684ad77121
<mask token>

<mask token>
print(ans)

<mask token>
input = sys.stdin.readline
n = int(input())
data = list(map(int, input().split()))
ans = min(data) * max(data)
print(ans)

import sys
input = sys.stdin.readline
n = int(input())
data = list(map(int, input().split()))
ans = min(data) * max(data)
print(ans)
