#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  if (n <= 3) {
    cout << 1 << endl;
    return 0;
  }
  vector<pair<int, int>> vec(n + 1);
  vec[0].first = INT_MIN;
  for (int i = 1; i <= n; i++) {
    cin >> vec[i].first;
    vec[i].second = i;
  }
  sort(vec.begin(), vec.end());
  int t = vec[3].first - vec[2].first;
  bool flag = true;
  for (int i = 4; i <= n; i++)
    if (vec[i].first - vec[i - 1].first != t) flag = false;
  if (flag) {
    cout << vec[1].second << endl;
    return 0;
  }
  t = vec[3].first - vec[1].first;
  flag = true;
  for (int i = 4; i <= n; i++)
    if (vec[i].first - vec[i - 1].first != t) flag = false;
  if (flag) {
    cout << vec[2].second << endl;
    return 0;
  }
  t = vec[2].first - vec[1].first;
  flag = true;
  int p = 0;
  for (int i = 3; i <= n; i++) {
    if (vec[i].first - vec[i - 1].first != t) {
      if (!p) {
        p = i;
        vec[i].first = vec[i - 1].first;
      } else {
        flag = false;
      }
    }
  }
  if (flag) {
    if (!p) cout << 1 << endl;
    if (p) cout << vec[p].second << endl;
    return 0;
  }
  cout << -1 << endl;
}
