#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
ll sticks[100005];
ll best[100005];

int main(){
	int N;
	cin >> N;
	for(int a = 0; a < N; a++){
		cin >> sticks[a];
	}
	sort(sticks, sticks + N);
	int bestcnt = 0;
	for(int a = 0; a + 1 < N; a++){
		if(sticks[a] == sticks[a + 1]){
			best[bestcnt++] = sticks[a];
			a++;
		}
	}
	if(bestcnt < 2){
		cout << 0;
	} else {
		cout << best[bestcnt - 1] * best[bestcnt - 2];
	}
}