#include <iostream>
using namespace std;
int main()
{
int n, nr, max1, max2,P;
cin>>n>>max1>>max2;
if(max1<max2){max1=max1+max2; max2=max1-max2; max1=max1-max2;}
n=n-2;
while(n){
cin>>nr;
if(nr>max1){max2=max1; max1=nr;}
else if(nr>max2) max2=nr;
n--;
}
P=max1*max2;
cout<<P;
return 0;
}