#include <iostream>
using namespace std;
int main()
{
int n, max = -10000000, min = 10000000;
cin >> n;
int a[n];
for (int i = 1; i <= n; i++)
{
cin >> a[i];
if (a[i] > max)
{
max = a[i];
}
if (a[i] < min)
{
min = a[i];
}
}
cout << max * min;
return 0;
}