#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)4e5 + 50;
int n;
struct X {
  long long val;
  int pos;
} a[maxn];
bool cmp(X u, X v) { return u.val < v.val; }
map<long long, long long> c;
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i].val;
    a[i].pos = i;
    ++c[a[i].val];
  }
  if (n == 2) {
    cout << 1;
    exit(0);
  }
  sort(a + 1, a + n + 1, cmp);
  int chk = 0;
  long long diff = a[3].val - a[2].val;
  for (int i = 3; i < n; ++i) {
    if (diff != a[i + 1].val - a[i].val) {
      chk = 1;
      break;
    }
  }
  if (!chk) {
    cout << a[1].pos;
    exit(0);
  }
  chk = 0;
  diff = a[n - 1].val - a[n - 2].val;
  for (int i = 1; i < n - 2; ++i) {
    if (diff != a[i + 1].val - a[i].val) {
      chk = 1;
      break;
    }
  }
  if (!chk) {
    cout << a[n].pos;
    exit(0);
  }
  long long d = a[n].val - a[1].val;
  if (d % (n - 2) != 0) {
    cout << -1;
    exit(0);
  }
  d /= (n - 2);
  long long ptr = a[1].val;
  for (int i = 1; i < n; ++i) {
    if (c[ptr])
      --c[ptr];
    else {
      cout << -1;
      exit(0);
    }
    ptr += d;
  }
  int cntans = 0;
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    if (c[a[i].val]) {
      ans = a[i].pos;
      ++cntans;
      --c[a[i].val];
    }
  }
  if (cntans > 1)
    cout << -1;
  else
    cout << ans;
}
