#include <bits/stdc++.h>
using namespace std;
char buf[2100000], *p1 = buf, *p2 = buf;
long long read() {
  long long x = 0, f = 1;
  char ch =
      (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)
           ? EOF
           : *p1++);
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch =
        (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)
             ? EOF
             : *p1++);
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch & 15);
    ch =
        (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)
             ? EOF
             : *p1++);
  }
  return x * f;
}
struct ele {
  int x, id;
  friend bool operator<(ele a, ele b) { return a.x < b.x; }
} a[200100];
int main() {
  int n = read();
  for (int i = 1; i <= n; ++i) a[i].x = read(), a[i].id = i;
  sort(a + 1, a + 1 + n);
  int flag = 0;
  for (int i = 4; i <= n; ++i)
    if (a[i].x - a[i - 1].x != a[i - 1].x - a[i - 2].x) {
      flag = 1;
      break;
    }
  if (!flag) {
    printf("%d\n", a[1].id);
    return 0;
  }
  flag = 0;
  for (int i = 3; i < n; ++i)
    if (a[i].x - a[i - 1].x != a[i - 1].x - a[i - 2].x) {
      flag = 1;
      break;
    }
  if (!flag) {
    printf("%d\n", a[n].id);
    return 0;
  }
  flag = 0;
  for (int i = 4; i <= n; ++i)
    if (a[i].x - a[i - 1].x != a[3].x - a[1].x) {
      flag = 1;
      break;
    }
  if (!flag) {
    printf("%d\n", a[2].id);
    return 0;
  }
  flag = 0;
  int D = a[2].x - a[1].x, t = 1;
  for (int i = 1; i <= n - 2; ++i)
    if (a[i + 1].x - a[i].x != D) {
      if (flag) {
        puts("-1");
        return 0;
      }
      if ((long long)a[i + 2].x - a[i].x == D) {
        flag = 1;
        t = a[i + 1].id;
        ++i;
        continue;
      } else {
        puts("-1");
        return 0;
      }
    }
  printf("%d\n", t);
  return 0;
}
