#include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<int, int> > a;
int CheckDiff(int d) {
  int ans = 1;
  bool ans_set = false;
  for (int i = 1; i < n; i++) {
    if (a[i].first - a[i - 1].first != d) {
      if (!ans_set && i == 1 && ((n == 2) || (a[2].first - a[1].first == d))) {
        ans = a[0].second + 1;
        ans_set = true;
      } else if (!ans_set &&
                 ((i + 1 < n && a[i + 1].first - a[i - 1].first == d) ||
                  i == n - 1)) {
        ans = a[i].second + 1;
        ans_set = true;
        i++;
      } else
        return -1;
    }
  }
  if (!ans_set) return a[0].second + 1;
  return ans;
}
int main() {
  cin >> n;
  a.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a.begin(), a.end());
  int c = CheckDiff(a[1].first - a[0].first);
  if (c != -1) {
    cout << c << endl;
  } else if (n >= 3 && CheckDiff(a[2].first - a[1].first) != -1) {
    cout << CheckDiff(a[2].first - a[1].first) << endl;
  } else if (n >= 3 && CheckDiff(a[2].first - a[0].first) != -1) {
    cout << CheckDiff(a[2].first - a[0].first) << endl;
  } else
    cout << -1 << endl;
}
