#include <bits/stdc++.h>
using namespace std;
int const N = 2e5 + 5;
struct node {
  int id, v;
} a[N];
bool com(node a1, node a2) { return a1.id < a2.id ? 1 : 0; }
int jieti() {
  int n, cha, dele = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i].id, a[i].v = i;
  if (n <= 3) {
    printf("1");
    return 1;
  }
  sort(a + 1, a + n + 1, com);
  int flag = 0;
  if (a[3].id - a[2].id != a[2].id - a[1].id) {
    if (a[4].id - a[3].id == a[3].id - a[2].id)
      dele = 1, cha = a[4].id - a[3].id;
    else if (a[4].id - a[3].id == a[3].id - a[1].id)
      dele = 2, cha = a[4].id - a[3].id;
    else if (a[4].id - a[2].id == a[2].id - a[1].id)
      dele = 3, cha = a[4].id - a[2].id;
    else {
      printf("-1");
      return 1;
    }
    flag++;
  } else
    cha = a[3].id - a[2].id;
  for (int i = (dele ? 5 : 4); i <= n; i++) {
    if (a[i].id - a[i - 1].id != cha) {
      flag++;
      dele = i;
      a[i].id = a[i - 1].id;
      if (flag >= 2) {
        printf("-1");
        return 1;
      }
    }
  }
  if (dele == 0)
    printf("%d", a[1].v);
  else
    printf("%d", a[dele].v);
}
int main() {
  jieti();
  return 0;
}
