#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> V(n);
  vector<int> diff(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> V[i];
  }
  vector<int> O(V);
  sort(V.begin(), V.end());
  map<int, int> freq;
  for (int i = 0; i + 1 < n; i++) {
    diff[i] = V[i + 1] - V[i];
    freq[diff[i]]++;
  }
  int big = -1;
  int bfreq = -1;
  for (auto& it : freq) {
    bfreq = max(bfreq, it.second);
  }
  vector<int> B;
  for (auto& it : freq) {
    if (it.second == bfreq) {
      B.push_back(it.first);
    }
  }
  for (int big : B) {
    vector<int> npos;
    for (int i = 0; i + 1 < n; i++) {
      if (diff[i] != big) {
        npos.push_back(i);
      }
    }
    if (npos.size() == 1 && npos.back() == 0) {
      cout << min_element(O.begin(), O.end()) - O.begin() + 1 << '\n';
      return 0;
    }
    if (npos.size() == 1 && npos.back() == n - 2) {
      cout << max_element(O.begin(), O.end()) - O.begin() + 1 << '\n';
      return 0;
    }
    if (npos.size() == 0) {
      cout << min_element(O.begin(), O.end()) - O.begin() + 1 << '\n';
      return 0;
    }
    if (npos.size() == 1 && diff[npos[0]] == 0) {
      cout << find(O.begin(), O.end(), V[npos[0]]) - O.begin() + 1 << '\n';
      return 0;
    }
    if (npos.size() != 2 || npos[1] - npos[0] != 1 ||
        diff[npos[0]] + diff[npos[1]] != big) {
      continue;
    }
    cout << find(O.begin(), O.end(), V[npos[1]]) - O.begin() + 1 << '\n';
    return 0;
  }
  cout << -1 << '\n';
  return 0;
}
