#include <bits/stdc++.h>
using namespace std;
bool comp(pair<int, int> a, pair<int, int> b) { return a.first < b.first; }
int main() {
  int n, i, mmin, ans, k;
  cin >> n;
  vector<pair<int, int> > a(n);
  vector<int> res;
  map<int, int> m;
  for (i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a.begin(), a.end(), comp);
  for (i = 1; i < n; i++) {
    mmin = a[i].first - a[i - 1].first;
    if (m[mmin] == 0) {
      res.push_back(mmin);
      m[mmin] = 1;
    }
  }
  bool p = 1;
  if (res.size() > 3)
    p = 0;
  else {
    mmin = -1;
    k = 1;
    for (i = 2; i < n; i++) {
      if (mmin == -1)
        mmin = a[i].first - a[i - 1].first;
      else {
        if (a[i].first - a[i - 1].first != mmin) k++;
      }
    }
    if (k == 1)
      ans = a[0].second;
    else {
      mmin = a[1].first - a[0].first;
      ans = -1;
      for (i = 1; i < n; i++) {
        if ((a[i].first != a[0].first + i * mmin && ans == -1) ||
            (ans != -1 && a[i].first != a[0].first + (i - 1) * mmin)) {
          if (ans != -1)
            break;
          else
            ans = a[i].second;
        }
      }
      if (i != n) {
        mmin = a[n - 1].first - a[n - 2].first;
        ans = -1;
        for (i = 1; i < n; i++) {
          if ((a[i].first != a[0].first + i * mmin && ans == -1) ||
              (ans != -1 && a[i].first != a[0].first + (i - 1) * mmin)) {
            if (ans != -1)
              p = 0;
            else
              ans = a[i].second;
          }
        }
      }
    }
  }
  if (!p)
    cout << -1;
  else
    cout << ans + 1 << '\n';
  return 0;
}
