#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void freekick() {}
const int DX[] = {+1, 0, -1, 0, +1, +1, -1, -1};
const int DY[] = {0, +1, 0, -1, +1, -1, +1, -1};
void freegoal() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
}
signed main() {
  freekick();
  freegoal();
  int n;
  cin >> n;
  pair<int, int> a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i + 1;
  }
  sort(a, a + n);
  int dif = a[1].first - a[0].first;
  int answer = 0;
  for (int i = 2; i < n; i++) {
    if (a[i].first - a[i - 1].first != dif) {
      if (answer != 0) {
        answer = -1;
        break;
      }
      if (i == n - 1 || a[i + 1].first - a[i - 1].first == dif) {
        answer = i;
        i++;
        continue;
      } else {
        answer = -1;
        break;
      }
    }
  }
  if (answer != -1) {
    cout << a[answer].second << endl;
    return 0;
  }
  dif = a[2].first - a[0].first;
  answer = 1;
  for (int i = 3; i < n; i++) {
    if (a[i].first - a[i - 1].first != dif) {
      answer = -1;
      break;
    }
  }
  if (answer != -1) {
    cout << a[answer].second << endl;
    return 0;
  }
  dif = a[2].first - a[1].first;
  answer = 0;
  for (int i = 3; i < n; i++) {
    if (a[i].first - a[i - 1].first != dif) {
      answer = -1;
      break;
    }
  }
  if (answer != -1) {
    cout << a[answer].second << endl;
    return 0;
  }
  cout << answer << endl;
  return false;
}
