#include <bits/stdc++.h>
using namespace std;
void printprecise(double l, long long int precision) {
  std::cout << std::fixed;
  std::cout << std::setprecision(precision);
  std::cout << l;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  vector<pair<long long int, long long int>> ar;
  for (long long int x = 0; x < n; x++) {
    long long int a;
    cin >> a;
    ar.push_back(make_pair(a, x + 1));
  }
  if (n <= 3) {
    cout << 1;
    return 0;
  }
  sort(ar.begin(), ar.end());
  long long int f1 = 0, i1 = -1;
  long long int f2 = 0;
  long long int f3 = 0;
  long long int p = 0;
  long long int count = 0;
  if ((ar[n - 1].first - ar[0].first) % (n - 2) == 0) {
    long long int c = (ar[n - 1].first - ar[0].first) / (n - 2);
    for (long long int x = 0; x < n - 1; x++) {
      if (ar[x + 1].first - ar[x].first != c) {
        if (x != (n - 2)) {
          if (ar[x + 2].first - ar[x].first == c && count == 0) {
            i1 = ar[x + 1].second;
            x++;
            count++;
          } else {
            f1 = 1;
            break;
          }
        } else {
          f1 = 1;
          break;
        }
      }
    }
    if (f1 == 0) {
      if (i1 == -1) i1 = 1;
      cout << i1;
      p = 1;
    }
  }
  if ((ar[n - 1].first - ar[1].first) % (n - 2) == 0 && p == 0) {
    long long int c = (ar[n - 1].first - ar[1].first) / (n - 2);
    for (long long int x = 1; x < n - 1; x++) {
      if (ar[x + 1].first - ar[x].first != c) {
        f2 = 1;
        break;
      }
    }
    if (f2 == 0) {
      cout << ar[0].second;
      p = 1;
    }
  }
  if ((ar[n - 2].first - ar[0].first) % (n - 2) == 0 && p == 0) {
    long long int c = (ar[n - 2].first - ar[0].first) / (n - 2);
    for (long long int x = 0; x < n - 2; x++) {
      if (ar[x + 1].first - ar[x].first != c) {
        f3 = 1;
        break;
      }
    }
    if (f3 == 0) {
      cout << ar[n - 1].second;
      p = 1;
    }
  }
  if (p == 0) {
    cout << -1;
  }
}
