#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> b(n);
  map<long long, long long> mp;
  for (long long i = 0; i < n; i++) {
    cin >> b[i];
    mp[b[i]] = i + 1;
  }
  sort(begin(b), end(b));
  if (n == 3) {
    cout << 1 << "\n";
    return 0;
  }
  vector<long long> dif;
  for (long long i = 1; i < n; i++) {
    long long v = b[i] - b[i - 1];
    dif.push_back(v);
  }
  long long indx;
  sort(begin(dif), end(dif));
  if (dif.front() == dif.back()) {
    indx = b[0];
  } else {
    if (dif[0] == 0 && dif[1] == dif.back()) {
      for (long long i = 1; i < n; i++) {
        if (b[i] - b[i - 1] == 0) {
          indx = b[i];
          break;
        }
      }
    } else if (dif[0] + dif[1] == dif.back() && dif[2] == dif.back()) {
      long long pos1, pos2;
      pos1 = -1;
      for (long long i = 1; i < n; i++) {
        long long v = b[i] - b[i - 1];
        if (v == dif[0] && pos1 == -1) {
          pos1 = i;
        }
        if (v == dif[1]) {
          pos2 = i;
        }
      }
      if (abs(pos1 - pos2) > 1) {
        cout << -1 << "\n";
        return 0;
      } else {
        indx = b[min(pos1, pos2)];
      }
    } else if (dif[0] == dif[n - 3] && (b[n - 1] - b[n - 2] == dif.back())) {
      indx = b.back();
    } else if (dif[0] == dif[n - 3] && (b[1] - b[0] == dif.back())) {
      indx = b.front();
    } else if (dif[1] == dif.back() && b[1] - b[0] == dif.front()) {
      indx = b.front();
    } else if (dif[1] == dif.back() && b[n - 1] - b[n - 2] == dif.front()) {
      indx = b.back();
    } else {
      cout << -1 << "\n";
      return 0;
    }
  }
  cout << mp[indx] << "\n";
  return 0;
}
