#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int main(){
	int i,n;
	long long c,d,e;
	cin >> n;
	vector<long long> a(n+4);
	for(i=0;i<n;i++){
		cin >> a[i];
	}
	sort(a.begin(),a.end());
	for(i=0;i<n+3;i++){
		if(a[n+3-i]==a[n+2-i]){
			c = a[n+3-i];
			d = i;
			break;
		}
	}
	for(i=0;i<n+1-d;i++){
		if(a[n+1-d-i]==a[n-d-i]){
			e = a[n+1-d-i];
			break;
		}
	}
	cout << c*e << endl;
}
	
	