#include <bits/stdc++.h>
using namespace std;
int n;
struct node {
  int val, id;
} a[200010];
inline bool cmp(node a, node b) { return a.val < b.val; }
inline bool jud(int l, int r, int d) {
  for (int i = l + 1; i <= r; ++i)
    if (a[i].val - a[i - 1].val != d) return 0;
  return 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i].val);
    a[i].id = i;
  }
  sort(a + 1, a + n + 1, cmp);
  if (jud(2, n, a[3].val - a[2].val)) {
    printf("%d\n", a[1].id);
    return 0;
  }
  int x = a[2].val;
  a[2].val = a[1].val;
  if (jud(2, n, a[3].val - a[2].val)) {
    printf("%d\n", a[2].id);
    return 0;
  }
  a[2].val = x;
  int d = a[2].val - a[1].val;
  for (int i = 3; i <= n; ++i) {
    if (a[i].val - a[i - 1].val != d) {
      a[i].val = a[i - 1].val;
      if (jud(i, n, d))
        printf("%d\n", a[i].id);
      else
        puts("-1");
      return 0;
    }
  }
  return 0;
}
