#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
pair<int, int> vet[N];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> vet[i].first;
    vet[i].second = i + 1;
  }
  sort(vet, vet + n);
  if (n <= 10) {
    for (int i = 0; i < n; i++) {
      vector<int> aux;
      for (int j = 0; j < n; j++) {
        if (j != i) aux.push_back(vet[j].first);
      }
      bool flag = true;
      for (int j = 2; j < aux.size(); j++) {
        if (aux[j] - aux[j - 1] != aux[j - 1] - aux[j - 2]) flag = false;
      }
      if (flag) {
        cout << vet[i].second << endl;
        return 0;
      }
    }
    cout << -1 << endl;
    return 0;
  }
  bool first = false;
  for (int i = 3; i < n; i++) {
    if (vet[i].first - vet[i - 1].first != vet[i - 1].first - vet[i - 2].first)
      first = true;
  }
  if (!first) {
    cout << vet[0].second << endl;
    return 0;
  }
  bool last = false;
  for (int i = 2; i < n - 1; i++) {
    if (vet[i].first - vet[i - 1].first != vet[i - 1].first - vet[i - 2].first)
      last = true;
  }
  if (!last) {
    cout << vet[n - 1].second << endl;
    return 0;
  }
  int mx = -1, maior = 0;
  map<int, int> mapa;
  for (int i = 1; i < n; i++) {
    mapa[vet[i].first - vet[i - 1].first]++;
    if (mx == -1 || mx < mapa[vet[i].first - vet[i - 1].first]) {
      mx = mapa[vet[i].first - vet[i - 1].first];
      maior = vet[i].first - vet[i - 1].first;
    }
  }
  if (mx != n - 3) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 1; i < n - 1; i++) {
    if (vet[i].first - vet[i - 1].first != maior &&
        vet[i + 1].first - vet[i].first != maior &&
        vet[i + 1].first - vet[i - 1].first == maior) {
      cout << vet[i].second << endl;
      return 0;
    }
  }
}
