#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	
	long long int n,l[100000],t=0,y=0,b=0,b2=0,bf;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>l[i];
	}
	sort(l,l+n);
	for(long long int i=n-1;i>0;i--){
		if(l[i]==l[i-1] && b==0){
			t=l[i];
			bf=i-1;
			b=1;
		}
		if(l[i]==l[i-1] && bf>i && b2==0){
			y=l[i];
			b2=1;
            break;
		}
	}
	cout<<t*y<<endl;
	return 0;
}
