#include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<int, int>> a;
void check(int pos) {
  vector<pair<int, int>> b;
  for (int i = 0; i < int(n); i++)
    if (i != pos) b.push_back(a[i]);
  if (b.size() > 2) {
    int d = b[1].first - b[0].first;
    for (int i = 0; i < int(int(b.size()) - 1); i++)
      if (b[i + 1].first - b[i].first != d) return;
  }
  cout << a[pos].second + 1 << endl;
  exit(0);
}
int main() {
  cin >> n;
  a.resize(n);
  for (int i = 0; i < int(n); i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a.begin(), a.end());
  check(0);
  check(n - 1);
  int maxd = 0;
  for (int i = 0; i < int(n - 1); i++)
    maxd = max(maxd, a[i + 1].first - a[i].first);
  int cnt = 0;
  for (int i = 0; i < int(n - 1); i++)
    if (a[i + 1].first - a[i].first != maxd) {
      check(i);
      check(i + 1);
      cnt++;
      if (cnt > 2) break;
    }
  cout << -1 << endl;
}
