#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());
    vector<int> match;

    int last = 0, i = sticks.size() - 1;
    while (i >= 0) {
        if (last == sticks[i]) {
            match.push_back(sticks[i]);
            last = 0;
        } else last = sticks[i];

        i--;
    }

    if (match.size() >= 2) printf("%d", match[0] * match[1]);
    else printf("0");

    return 0;
}
