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

int main(){
    size_t N;
    cin >> N;
    map<unsigned long, unsigned long> a;
    unsigned long ans0{0}, ans1{0};
    for(unsigned long i = 0, A; i < N; ++i){
        cin >> A;
        if(++a[A] == 2){
            a[A] = 0;
            if(ans0 < A)swap(ans0, A);
            if(ans1 < A)swap(ans1, A);
        }
    }
    cout << ans0 * ans1 << endl;
}