#include <iostream>
#include <algorithm>
using namespace std;


int main(){
	int n;
	scanf("%d", &n);
	int a[n];
	for(int i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}
	sort(a, a+n);
	int i;
	long w = 0, h = 0;
	for(i = n - 1; i > 0; i--){
		if(a[i] == a[i-1]){
			w = a[i];
			i = i-2;
			break;
		}
	}
	for( ; i > 0; i--){
		if(a[i] == a[i-1]){
			h = a[i];
			break;
		}
	}
	printf("%ld\n", h*w);
	return 0;
}