#include <stdio.h>
#include <iostream>
#include <map>
using namespace std;
map<int, int> mp;
map<int, int>::reverse_iterator itor;
int tmp, cnt, side[2];
long long ans;

int main() {
	int n = 0;
	while(scanf("%d", &n) == 1) {
		mp.clear(), cnt = 0, ans = 0;
		for (int i = 0; i < n; ++i) {
			scanf("%d", &tmp);
			++mp[tmp];
		}
		for (itor = mp.rbegin(); itor != mp.rend(); ++itor) {
			if (itor->second < 2) continue;
			if (itor->second >= 4 && cnt == 0) {
				ans = (long long) (itor->first) * (itor->first);
				break;
			}
			side[cnt++] = itor->first;
			if (cnt == 2) break;
		}
		if (cnt) ans = side[0] * side[1];
		printf("%lld\n", ans);
	}
	return 0;
}
