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



int main()
{
	int n;
	cin >> n;
	vector<long long> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(), greater<long long>());
	vector<long long> p;
	for (int i = 0; i < n - 1; i++) {
		if (a[i] == a[i + 1]) {
			p.push_back(a[i]);
			i++;
		}
		if (p.size() == 2) {
			cout << p[0] * p[1] << endl;
			return 0;
		}
		
	}
	cout << 0 << endl;
	return 0;
}

