#include<bits/stdc++.h>
using namespace std;
int main(){
     int n,t;
     vector<int> rec;
     cin >> n;
     priority_queue<int> q;
     for(int i=0;i<n;i++){
        cin >> t;
        q.push(t);
     }
     for(int i=0;i<n;i++){
        t=q.top();
        q.pop();
        if(q.top()==t){
            rec.push_back(t);
            q.pop();
            i++;
            if(rec.size()==2)
                break;
        }
     }
    if(rec.size()==2)
        cout << rec[0]*rec[1];
    else
        cout << '0';
}
