#include <bits/stdc++.h>
using namespace std;
int n, b[200005], id[200005], dist[200005];
int main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> b[i], id[i] = i;
  sort(id + 1, id + 1 + n, [](int x, int y) { return b[x] < b[y]; });
  int dist;
  bool ok;
  dist = b[id[3]] - b[id[2]];
  ok = true;
  for (int i = 3; i <= n - 1; ++i) {
    if (b[id[i + 1]] - b[id[i]] != dist) {
      ok = false;
      break;
    }
  }
  if (ok) {
    cout << id[1];
    return 0;
  }
  dist = b[id[3]] - b[id[1]];
  ok = true;
  for (int i = 3; i <= n - 1; ++i) {
    if (b[id[i + 1]] - b[id[i]] != dist) {
      ok = false;
      break;
    }
  }
  if (ok) {
    cout << id[2];
    return 0;
  }
  dist = b[id[2]] - b[id[1]];
  ok = true;
  id[n + 1] = n + 1;
  b[id[n + 1]] = b[id[n - 1]] + dist;
  int extraElement = -1;
  for (int i = 2; i <= n - 1; ++i) {
    if (b[id[i + 1]] - b[id[i]] == dist) continue;
    if (b[id[i]] + dist == b[id[i + 2]]) {
      if (extraElement != -1) {
        ok = false;
        break;
      } else {
        extraElement = id[i + 1];
        ++i;
      }
    } else {
      ok = false;
      break;
    }
  }
  if (!ok)
    cout << -1;
  else
    cout << extraElement;
  return 0;
}
