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

int main(){
  int n;
  cin >> n;
  map<int, int> mp;
  int a;
  vector<long long> v;
  for ( int i = 0; i < n; i++){
    cin >> a;
    mp[a]++;
    if ( mp[a] % 2 == 0 && mp[a] > 0){
      v.push_back(a);
    }
  }

  sort(v.begin(), v.end(), greater<int>());
  if ( v.size() < 2){
    cout << 0 << endl;
  } else {
    long long ans =  v[0]*v[1];
    cout << ans << endl;
  }


  return 0;
}