#include <bits/stdc++.h>
using namespace std;
const int N = 5e5;
const int LOG = 20;
const int cntsz = 101;
bool isProgression(vector<pair<int, int> > a) {
  vector<int> delta;
  sort(a.begin(), a.end());
  for (int i = int(1); i < int((int)(a).size()); i++)
    delta.push_back(a[i].first - a[i - 1].first);
  sort(delta.begin(), delta.end());
  return delta.front() == delta.back();
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<pair<int, int> > b(n);
  for (int i = 0; i < int(n); i++) {
    cin >> b[i].first;
    b[i].second = i;
  }
  if (n <= 3) {
    cout << "1\n";
    return 0;
  }
  sort(b.begin(), b.end());
  vector<pair<int, int> > start(b.begin() + 1, b.end());
  if (isProgression(start)) {
    cout << b.front().second + 1 << "\n";
    return 0;
  }
  vector<pair<int, int> > finish(b.begin(), b.end() - 1);
  if (isProgression(finish)) {
    cout << b.back().second + 1 << "\n";
    return 0;
  }
  vector<int> delta(n - 1);
  for (int i = 0; i < int(n - 1); i++) {
    delta[i] = b[i + 1].first - b[i].first;
  }
  sort(delta.begin(), delta.end());
  if (delta.front() == delta.back()) {
    cout << "1\n";
    return 0;
  }
  if (delta[0] + delta[1] == delta[2]) {
    if (delta[2] != delta.back()) {
      cout << "-1\n";
      return 0;
    } else {
      for (int i = int(1); i < int(n - 1); i++) {
        if (b[i + 1].first - b[i - 1].first == delta.back()) {
          cout << b[i].second + 1 << "\n";
          return 0;
        }
      }
    }
  } else {
    cout << "-1\n";
  }
  return 0;
}
