#include <bits/stdc++.h>
using namespace std;
int n;
int a[200010];
struct node {
  int sum, id;
  bool operator<(const node &T) const { return sum < T.sum; }
} s[200010];
int main() {
  int d, id;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    s[i].id = i;
    s[i].sum = a[i];
  }
  if (n <= 3) {
    puts("1");
    return 0;
  }
  sort(s + 1, s + 1 + n);
  id = -1;
  d = s[2].sum - s[1].sum;
  for (int i = 3; i <= n; i++) {
    if (s[i].sum - s[i - 1].sum != d) {
      if (id == -1 && (i == n || s[i + 1].sum - s[i - 1].sum == d))
        id = s[i].id;
      else if (id == s[i - 1].id && s[i].sum - s[i - 2].sum == d)
        continue;
      else {
        id = -2;
        break;
      }
    }
  }
  if (id == -1) {
    printf("%d\n", s[1].id);
    return 0;
  } else if (id != -2) {
    printf("%d\n", id);
    return 0;
  }
  id = s[2].id;
  d = s[3].sum - s[1].sum;
  for (int i = 4; i <= n; i++) {
    if (s[i].sum - s[i - 1].sum != d) {
      id = -1;
      break;
    }
  }
  if (id != -1) {
    printf("%d\n", id);
    return 0;
  }
  id = s[1].id;
  d = s[3].sum - s[2].sum;
  for (int i = 4; i <= n; i++) {
    if (s[i].sum - s[i - 1].sum != d) {
      id = -1;
      break;
    }
  }
  printf("%d\n", id);
  return 0;
}
