#include <bits/stdc++.h>
using namespace std;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string Alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string glas = "aeiou";
long long int Mod = 1e9 + 7;
long long int INF = 5e18;
int main() {
  iostream::sync_with_stdio(false);
  cin.tie(0);
  long long int n;
  cin >> n;
  vector<pair<long long int, long long int> > v(n);
  for (long long int i = 0; i < n; i++) {
    cin >> v[i].first;
    v[i].second = i;
  }
  sort(v.begin(), v.end());
  set<long long int> s;
  for (long long int i = 1; i < n; i++) s.insert(v[i].first - v[i - 1].first);
  if (s.size() > 3) {
    cout << "-1";
    return 0;
  } else if (s.size() == 1 || n <= 2) {
    cout << v[0].second + 1;
    return 0;
  }
  vector<long long int> ans;
  for (long long int i = 1; i < n; i++) {
    if (s.find(v[i].first - v[i - 1].first) != s.end())
      ans.push_back(i), ans.push_back(i - 1),
          s.erase(s.find(v[i].first - v[i - 1].first));
  }
  vector<long long int>::iterator itt;
  for (itt = ans.begin(); itt != ans.end(); itt++) {
    long long int it = *itt;
    set<long long int> check;
    long long int i = 0;
    if (it == 0) i++;
    long long int prev = v[i].first;
    i++;
    for (; i < n; i++) {
      if (i == it) continue;
      check.insert(v[i].first - prev);
      check.insert(v[i].first - prev);
      prev = v[i].first;
    }
    if (check.size() == 1) {
      cout << v[it].second + 1;
      return 0;
    }
    check.clear();
  }
  cout << -1;
  return 0;
}
