#include <bits/stdc++.h>

using namespace std;

int main() {

    int n;
    scanf("%d", &n);

    vector<int> sticks;

    for (int i = 0; i < n; i++) {
        int d;
        scanf("%d", &d);
        sticks.push_back(d);
    }

    sort(sticks.begin(), sticks.end());

    int a[2];
    int index = 0;
    vector<int> count;

    for (int i = sticks.size() - 1; i >= 0; i--) {
        count[sticks[i]] += 1;

        if (count[sticks[i]] == 2) {
            a[index] = sticks[i];
            index++;
            if (index == 2) break;
        }
    }

    printf("%d\n", a[0] * a[1]);

    return 0;
}
