#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
void Compute(long long int n) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  vector<long long int> ar(n);
  map<long long int, long long int> mp;
  for (long long int i = 0; i < n; i++) {
    cin >> ar[i];
    mp[ar[i]] = i;
  }
  sort(ar.begin(), ar.end());
  if (n == 2)
    cout << 1 << "\n";
  else {
    bool ok2, ok3;
    long long int index = 3;
    bool ok1 = ok2 = ok3 = true;
    {
      long long int a = ar[1], d = ar[2] - ar[1];
      for (long long int i = 3; i < n; i++) {
        if (ar[i] != (a + (i - 1) * d)) {
          ok1 = false;
          break;
        }
      }
    }
    {
      long long int a = ar[0], d = ar[2] - ar[0];
      for (long long int i = 3; i < n; i++) {
        if (ar[i] != (a + (i - 1) * d)) {
          ok2 = false;
          break;
        }
      }
    }
    {
      long long int cnt = 0;
      long long int a = ar[0], d = ar[1] - ar[0];
      long long int active = 2;
      for (long long int i = 2; i < n; i++) {
        if (ar[i] != (a + (active)*d)) {
          cnt++;
          index = mp[ar[i]] + 1;
          if (cnt > 1) {
            ok3 = false;
            break;
          }
        } else
          active++;
      }
    }
    if (ok1) {
      cout << mp[ar[0]] + 1 << "\n";
    } else if (ok2) {
      cout << mp[ar[1]] + 1 << "\n";
    } else if (ok3) {
      cout << index << "\n";
    } else {
      cout << -1 << "\n";
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  cin >> n;
  Compute(n);
}
