#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];
    if(n<4)cout<<"0";
    else{
        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;
        }
        if(o==2)cout<<a[0]*a[1]<<endl;
        else cout<<"0";
    }
}