#include <iostream>
using namespace std;
int main(void)
{
int N;
int big = 0;
int small;
cin >> N;
for (int i = 0; i < N; i++)
{
int num;
cin >> num;
if (i == 0) small = num;
if (num > big) big = num;
if (num < small) small = num;
}
cout << big * small;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKHZvaWQpCnsKCWludCBOOwoJaW50IGJpZyA9IDA7CglpbnQgc21hbGw7CgljaW4gPj4gTjsKCglmb3IgKGludCBpID0gMDsgaSA8IE47IGkrKykKCXsKCQlpbnQgbnVtOwoJCWNpbiA+PiBudW07CgkJaWYgKGkgPT0gMCkgc21hbGwgPSBudW07CgkJaWYgKG51bSA+IGJpZykgYmlnID0gbnVtOwoJCWlmIChudW0gPCBzbWFsbCkgc21hbGwgPSBudW07Cgl9Cgljb3V0IDw8IGJpZyAqIHNtYWxsOwoJcmV0dXJuIDA7Cn0=