#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 = 0, b;
    map<int, int> count;

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

        if (count[sticks[i]] == 2)
            if (a == NULL) a = sticks[i];
            else { b = sticks[i]; break; }
    }
    printf("%d\n", a * b);

    return 0;
}
