#include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<int, int> > b;
bool check(int idx) {
  vector<int> temp;
  for (int i = 0; i < n; i++) {
    if (idx != i) temp.push_back(b[i].first);
  }
  for (int i = 1; i < temp.size(); i++) {
    if (temp[i] - temp[i - 1] != temp[1] - temp[0]) {
      return false;
    }
  }
  cout << b[idx].second + 1;
  return true;
}
int main() {
  cin >> n;
  int x;
  for (int i = 0; i < n; i++) {
    cin >> x;
    b.push_back({x, i});
  }
  sort(b.begin(), b.end());
  int diff = b[1].first - b[0].first;
  for (int i = 2; i < n; i++) {
    if (b[i].first - b[i - 1].first != diff) {
      if (check(i)) return 0;
      break;
    }
  }
  if (check(1))
    return 0;
  else if (check(0))
    return 0;
  cout << -1;
  return 0;
}
