#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18 + 10;
const long long inf = 1e9 + 10;
const long long N = 1e6 + 10;
int32_t main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  long long n;
  cin >> n;
  if (n == 2) {
    return cout << "1\n", 0;
  }
  vector<pair<long long, long long> > a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a.begin(), a.end());
  map<long long, long long> mp;
  for (long long i = 1; i < n; i++) {
    long long d = a[i].first - a[i - 1].first;
    mp[d]++;
  }
  for (long long i = 0; i < n; i++) {
    if (!i) {
      mp[a[i + 1].first - a[i].first]--;
      long long len = a[i + 2].first - a[i + 1].first;
      if (mp[len] >= n - 2) {
        return cout << a[i].second + 1 << "\n", 0;
      }
      mp[a[i + 1].first - a[i].first]++;
      continue;
    }
    if (i + 1 == n) {
      mp[a[i].first - a[i - 1].first]--;
      long long len = a[i - 1].first - a[i - 2].first;
      if (mp[len] >= n - 2) {
        return cout << a[i].second + 1 << "\n", 0;
      }
      mp[a[i].first - a[i - 1].first]++;
      continue;
    }
    long long len = a[i + 1].first - a[i - 1].first;
    mp[len]++;
    mp[a[i + 1].first - a[i].first]--;
    mp[a[i].first - a[i - 1].first]--;
    if (mp[len] >= n - 2) {
      return cout << a[i].second + 1 << "\n", 0;
    }
    mp[a[i].first - a[i - 1].first]++;
    mp[a[i + 1].first - a[i].first]++;
    mp[len]--;
  }
  cout << "-1\n";
  return 0;
}
