#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 1;
const int MAX = 100;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 5;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  sort(a.rbegin(), a.rend());
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    if (a[i] == a[i + 1]) {
      cnt += 2;
      ++i;
      continue;
    } else if (a[i] - 1 == a[i + 1]) {
      cnt += 2;
      a[i]--;
      ++i;
    }
  }
  sort(a.rbegin(), a.rend());
  if (cnt < 4) {
    cout << "0" << endl;
    return 0;
  }
  long long x = 0, y = 0, ans = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == a[i + 1] and x == 0) {
      x = a[i];
      ++i;
    } else if (a[i] == a[i + 1] and x != 0) {
      y = a[i];
      ++i;
    }
    if (x != 0 and y != 0) {
      ans += (long long)x * y;
      x = 0, y = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
