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