#include<bits/stdc++.h>
using namespace std;
int n,m;
priority_queue<int> pq;
multiset<int> s;
int cou=0;
int ans[2];
int main()
{
	int i,j;
	
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&m);
		pq.push(m);
	}
	
	while(!pq.empty())
	{
		if(cou==2)
		break;
		s.insert(pq.top());
		if(s.count(pq.top())==2)
		{
			ans[cou] = pq.top();
			cou++;
		}
		pq.pop();
	}
	
	printf("%d\n",ans[0]*ans[1]);
}