#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, i;
  cin >> n;
  vector<pair<long long, long long> > a(n);
  for (i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i + 1;
  }
  if (n <= 3) {
    cout << 1;
    return 0;
  }
  map<long long, long long> b;
  sort(a.begin(), a.end());
  for (i = 1; i < n; i++) {
    b[a[i].first - a[i - 1].first]++;
  }
  if (b[a[1].first - a[0].first] == n - 1) {
    cout << a[0].second;
    return 0;
  }
  for (i = 0; i < n - 1; i++) {
    if (i == 0) {
      b[a[1].first - a[0].first]--;
      if (b[a[2].first - a[1].first] == n - 2) {
        cout << a[0].second;
        return 0;
      }
      b[a[1].first - a[0].first]++;
    } else {
      b[a[i].first - a[i - 1].first]--;
      b[a[i + 1].first - a[i].first]--;
      b[a[i + 1].first - a[i - 1].first]++;
      if (b[a[i + 1].first - a[i - 1].first] == n - 2) {
        cout << a[i].second;
        return 0;
      }
      b[a[i].first - a[i - 1].first]++;
      b[a[i + 1].first - a[i].first]++;
      b[a[i + 1].first - a[i - 1].first]--;
    }
  }
  if (b[a[n - 2].first - a[n - 3].first] == n - 2 &&
      b[a[n - 1].first - a[n - 2].first] == 1) {
    cout << a[n - 1].second;
    return 0;
  }
  cout << -1;
  return 0;
}
