#include<iostream>
#include<algorithm>
#define int long long
using namespace std;

int n,a[100000],x1,x2;

signed main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	for(int i=n-1;i>=1;i--){
		if(a[i]==a[i-1]){
			if(x1!=0&&x2==0) x2=a[i];
			if(x1==0) x1=a[i];
			i--;
		}
	}
	int s=x1*x2;
	cout<<s<<endl;
	return 0;
}