#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int side[n],a[2]={0,0},o=0;
    for(int i=0;i<n;i++)cin>>side[i];
    sort(side,side+n,greater<int>());
    for(int i=1;i<n;i++)
    {
        if(side[i]==side[i-1]&&side[i]>0)
        {
            a[o++]=side[i];
            side[i]=-1;
            side[i-1]=-1;
        }
        if(o==2)break;
    }
    cout<<a[1]*a[0]<<endl;
}