#include <bits/stdc++.h>
using namespace std;
int n;
pair<int, int> a[200005];
map<int, int> mp;
bool comp(pair<int, int> pa, pair<int, int> pb) {
  if (pa.second == pb.second) return (pa.first < pb.first);
  return (pa.second < pb.second);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i].second, a[i].first = i;
  if (n <= 3) {
    cout << "1" << endl;
    exit(0);
  }
  sort(a + 1, a + n + 1, comp);
  for (int i = 2; i <= n; i++) mp[(a[i - 1].second - a[i].second)]++;
  int dif = a[1].second - a[2].second;
  if (mp[dif] == (n - 1)) {
    cout << a[1].first << endl;
    exit(0);
  }
  for (int i = 1; i <= n; i++) {
    if (i == 1) {
      dif = a[i].second - a[i + 1].second;
      mp[dif]--;
      dif = a[i + 1].second - a[i + 2].second;
      if (mp[dif] == (n - 2)) {
        cout << a[i].first << endl;
        exit(0);
      }
      dif = a[i].second - a[i + 1].second;
      mp[dif]++;
    } else if (i == n) {
      dif = a[i - 1].second - a[i].second;
      mp[dif]--;
      dif = a[i - 2].second - a[i - 1].second;
      if (mp[dif] == (n - 2)) {
        cout << a[i].first << endl;
        exit(0);
      }
      dif = a[i - 1].second - a[i].second;
      mp[dif]++;
    } else {
      dif = a[i - 1].second - a[i].second;
      mp[dif]--;
      dif = a[i].second - a[i + 1].second;
      mp[dif]--;
      dif = a[i - 1].second - a[i + 1].second;
      mp[dif]++;
      if (mp[dif] == (n - 2)) {
        cout << a[i].first << endl;
        exit(0);
      }
      dif = a[i - 1].second - a[i].second;
      mp[dif]++;
      dif = a[i].second - a[i + 1].second;
      mp[dif]++;
      dif = a[i - 1].second - a[i + 1].second;
      mp[dif]--;
    }
  }
  cout << "-1" << endl;
  return 0;
}
