#include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<int, int>> vp;
int chk() {
  bool ok = true;
  int d = vp[2].first - vp[1].first;
  for (int i = 2; i < n; i++)
    if (vp[i].first - vp[i - 1].first != d) ok = false;
  if (ok) {
    printf("%d\n", vp[0].second + 1);
    exit(0);
  }
  d = vp[2].first - vp[0].first;
  ok = true;
  for (int i = 3; i < n; ++i)
    if (vp[i].first - vp[i - 1].first != d) ok = false;
  if (ok) {
    printf("%d\n", vp[1].second + 1);
    exit(0);
  }
  d = vp[1].first - vp[0].first;
  int cnt = 0, index = 0;
  ok = true;
  for (int i = 1; i < n; i++) {
    if (vp[i].first - vp[i - 1].first == d) continue;
    cnt++;
    if (i == n - 1 or vp[i + 1].first - vp[i - 1].first != d) ok = false;
    index = vp[i].second;
    i++;
  }
  if (ok and cnt == 1) {
    cout << index + 1 << endl;
    exit(0);
  }
}
int main() {
  scanf("%d", &n);
  vp.resize(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &vp[i].first);
    vp[i].second = i;
  }
  sort(begin(vp), end(vp));
  chk();
  if (n < 4) return !printf("1\n");
  reverse(begin(vp), end(vp));
  chk();
  cout << -1 << endl;
}
