#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long double PI = acos(-1);
const long long MOD = 1000000007;
const long long FMOD = 998244353;
const long double eps = 1e-9;
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count());
long long n, pos;
pair<long long, long long> a[200005];
void check(long long p) {
  vector<long long> ans;
  for (long long i = 0; i < n; i++)
    if (i != p) ans.push_back(a[i].first);
  for (long long i = 1; i < ans.size() - 1; i++)
    if (ans[i] - ans[i - 1] != ans[i + 1] - ans[i]) return;
  cout << a[p].second + 1 << endl;
  exit(0);
}
signed main() {
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a, a + n);
  for (long long i = 1; i < n - 1; i++) {
    if (a[i + 1].first - a[i].first != a[i].first - a[i - 1].first) {
      pos = i;
      break;
    }
  }
  check(0);
  check(n - 1);
  check(pos - 1);
  check(pos + 1);
  check(pos);
  cout << "-1" << endl;
}
