#include<bits/stdc++.h>
using namespace std;
long long n,a,mx1=0,mx2=0;
map<long long,long long> mp;
priority_queue<long long> pq;
int main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++){
		scanf("%lld",&a);
		if(mp[a] == 0){
			mp[a] = 1;
		}
		else{
			mp[a] = 0;
			pq.push(a);
		}
	}
	if(pq.size() < 2){
		printf("0");
	}
	else{
		mx1 = pq.top();
		pq.pop();
		mx2 = pq.top();
		printf("%lld",mx1*mx2);
	}
	
}