#include <iostream>
#include <algorithm>
using namespace std;

int n, a[100000];

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);

	int height = 0, width = 0;
	for (int i = n-1; i > 0; i--) {
		if (a[i] == a[i - 1]) {
			if (height == 0)height = a[i];
			else if(width == 0)width = a[i];
			i--;
		}
	}

	long long menseki = height;
	menseki *= width;
	cout << menseki << endl;
}