#include <iostream>
#include <algorithm>
using namespace std;
const int maxn=100000+10;
int a[maxn];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a+1,a+n+1);
	int first=0;
	int second=0;
	for(int i=1;i<=n;i+=2){
		if(a[i]==a[i+1]){
			second=first;
			first=a[i];
		}
		else i--;
	}
	cout<<(long long)first*second<<endl;
	return 0;
}