#include <bits/stdc++.h>
using namespace std;
void out(vector<pair<int, int>>& v, int idx) {
  cout << v[idx].second << endl;
  exit(0);
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<pair<int, int>> in(n);
  for (int i = 0; i < n; i++) {
    cin >> in[i].first;
    in[i].second = i + 1;
  }
  sort(in.begin(), in.end());
  if (n == 2) {
    cout << 1 << endl;
    return 0;
  }
  vector<int> candidate = {in[1].first - in[0].first, in[2].first - in[1].first,
                           in[2].first - in[0].first};
  for (int dif : candidate) {
    int cnt = 0;
    for (int i = 1; i < n; i++) {
      if (in[i].first - in[i - 1].first != dif) cnt++;
    }
    if (cnt == 0) out(in, 0);
    if (cnt == 1) {
      if (in[1].first - in[0].first != dif) out(in, 0);
      if (in[n - 1].first - in[n - 2].first != dif) out(in, n - 1);
      for (int i = 1; i + 1 < n; i++) {
        if (in[i].first - in[i - 1].first != dif &&
            in[i + 1].first - in[i - 1].first == dif)
          out(in, i);
      }
    }
    if (cnt == 2) {
      for (int i = 1; i < n; i++) {
        if (in[i].first - in[i - 1].first != dif &&
            in[i + 1].first - in[i].first != dif &&
            in[i + 1].first - in[i - 1].first == dif) {
          out(in, i);
          break;
        }
        if (in[i].first - in[i - 1].first != dif &&
            in[i + 1].first - in[i].first == dif) {
          break;
        }
      }
    }
  }
  cout << -1 << endl;
  return 0;
}
