#include <bits/stdc++.h>
using namespace std;
pair<int, int> v[200010];
int n;
int tenta(int k, int ini, int quero) {
  int ant = ini - 1;
  int erro = 0, id = v[0].second + 1;
  for (int i = ini; i < n; i++) {
    if (v[i].first - v[ant].first != k)
      erro++, id = v[i].second + 1;
    else
      ant = i;
  }
  if (erro != quero) return -1;
  return id;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &v[i].first), v[i].second = i;
  sort(v, v + n);
  int res = max(tenta(v[1].first - v[0].first, 1, 1),
                max(tenta(v[2].first - v[0].first, 1, 1),
                    tenta(v[2].first - v[1].first, 2, 0)));
  printf("%d\n", res);
  return 0;
}
