#include<bits/stdc++.h>

using namespace std;

vector<long> v;

int main(){

    int x, i, n, mi = 0;
    long c, m[2]={};
    cin >> n;
    for(i = 0; i < n; ++i){
        cin >> x;
        v.push_back(x);
    }
    sort(v.begin(), v.end());
    for(i = 0; i < n; ++i){
        c = v.back();
        v.pop_back();
        if(c == v.back()){
            m[mi] = v.back();
            v.pop_back();
            mi++;
        }
        else
            v.pop_back();
        if(mi == 2)
            break;
    }
    cout << m[0] * m[1];
}
