#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    map<long long int,int>mp;
    //set<long long int>st;
    for(int i=0;i<n;i++)
    {
        long long num;
        cin>>num;
        mp[num]++;

    }
    auto it=mp.rbegin();
   // it--;
    long long mul=1;
    int d=4;
    while(it!=mp.rend())
    {
       // cout<<it->first<<" "<<it->second<<endl;
        if(it->second>=4&&d==4)
        {
            mul=mul*it->first*it->first;
            d-=4;

            //break;
        }
        else if(it->second>=2&&d>=2)
        {
            mul=mul*it->first;
            d-=2;
            //break;
        }
        if(d==0)break;
        it++;
    }
    if(d==4)cout<<0<<endl;
    else
        cout<<mul<<endl;
}
