#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int MAXN = 200005;
struct node {
  int val, id;
  bool operator<(const node a) const { return val < a.val; }
};
node in[MAXN];
int n, ret;
bool test(int id) {
  bool res = false;
  int d = in[1].val - in[0].val;
  for (int i = 2; i < n; i++) {
    if (i != id) {
      if (i == id + 1) {
        res |= (d != (in[i].val - in[i - 2].val));
      } else {
        res |= (d != (in[i].val - in[i - 1].val));
      }
    }
  }
  return !res;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  int d;
  bool flag;
  while (cin >> n) {
    for (int i = 1; i <= n; i++) {
      cin >> in[i - 1].val;
      in[i - 1].id = i;
    }
    if (n <= 3) {
      cout << "1\n";
      continue;
    }
    sort(in, in + n);
    d = in[2].val - in[1].val;
    flag = false;
    for (int i = 2; i < n; i++) {
      flag |= ((in[i].val - in[i - 1].val) != d);
    }
    if (!flag) {
      cout << in[0].id << '\n';
      continue;
    }
    d = in[2].val - in[0].val;
    flag = false;
    for (int i = 3; i < n; i++) {
      flag |= ((in[i].val - in[i - 1].val) != d);
    }
    if (!flag) {
      cout << in[1].id << '\n';
      continue;
    }
    d = in[1].val - in[0].val;
    for (int i = 2; i < n; i++) {
      if (d != in[i].val - in[i - 1].val) {
        if (test(i)) {
          cout << in[i].id << '\n';
        } else {
          cout << "-1\n";
        }
        break;
      }
    }
  }
  return 0;
}
