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

int main(){
  int n;
  cin >> n;
  vector<long> a(100100);
  long s[3] = {0};
  for(int i = 0;i < n;i++){
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  
  int i = 0,j = 0;
  while(j <= 2){
    if(a.at(i) == a.at(i+1)){
      s[j] = a[i];
      j++;
      i++;
    }
    i++;
    if(i == n){
      break;
    }
  }
  cout << s[0]*s[1] << endl;
}