#include<iostream>
#include<algorithm>

using namespace std;
int main()
{
	int n;
	while (cin>>n)
	{
		long long a[100005];
		for (int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
		sort(a, a + n);
		long long x = 0, y = 0;
		for (int i = n - 1; i > 0; i--)
		{
			if (a[i] == a[i - 1])
			{
				x = a[i - 1];
				break;
			}
		}
		for (int i = n - 2; i > 0; i--)
		{
			if (a[i] < x&&a[i] == a[i - 1])
			{
				y = a[i];
				break;
			}
		}
		cout << x*y << endl;
	}
	//system("pause");
	return 0;
}