#include <bits/stdc++.h>
using namespace std;
int in() {
  int x = 0, c;
  for (; (unsigned long long)((c = getchar()) - '0') >= 10;) {
    if (c == '-') return -in();
    if (!~c) throw ~0;
  }
  do {
    x = (x << 3) + (x << 1) + (c - '0');
  } while ((unsigned long long)((c = getchar()) - '0') < 10);
  return x;
}
long long in64() {
  long long x = 0, c;
  for (; (unsigned long long)((c = getchar()) - '0') >= 10;) {
    if (c == '-') return -in();
    if (!~c) throw ~0;
  }
  do {
    x = (x << 3) + (x << 1) + (c - '0');
  } while ((unsigned long long)((c = getchar()) - '0') < 10);
  return x;
}
void out(int n) {
  char buf[33];
  int i = 30;
  if (n < 0) putchar('-'), n = -n;
  do {
    buf[i--] = '0' + n % 10;
    n /= 10;
  } while (n);
  while (i < 30) putchar(buf[++i]);
}
void out64(long long n) {
  char buf[55];
  int i = 50;
  if (n < 0) putchar('-'), n = -n;
  do {
    buf[i--] = '0' + n % 10;
    n /= 10;
  } while (n);
  while (i < 50) putchar(buf[++i]);
}
void readArray(int array1[], int len) {
  for (int i = 0; i < len; i++) {
    array1[i] = in();
  }
}
void read2Array(int array1[], int array2[], int len) {
  for (int i = 0; i < len; i++) {
    array1[i] = in();
    array2[i] = in();
  }
}
int main() {
  int n = in();
  long long a, ans = 0, maxi = 0, x1 = 0;
  int y = 0, pre = 0, used = 0;
  map<long long, int> M;
  for (int i = (0), _b = (n); i < _b; i++) a = in(), ++M[a - 1], ++M[a];
  map<long long, int>::reverse_iterator i;
  a = 0;
  for (i = M.rbegin(); i != M.rend(); ++i) {
    long long x = i->first;
    int y1 = i->second;
    if (x + 1 == x1)
      y = y1 - used;
    else
      y = y1, pre = 0, a = 0, used = 0;
    if (maxi != 0 && y > 1) {
      ans += maxi * x;
      y -= 2;
      used += 2;
      maxi = 0;
    }
    int z = y / 4;
    ans += z * x * x;
    used += 4 * z;
    y = y % 4;
    if (y > 1 && maxi == 0) maxi = x, used += 2;
    used = max(0, used - pre);
    x1 = x;
    pre = y1 - pre;
  }
  cout << ans;
}
