#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, i;
  cin >> n;
  vector<pair<long long, long long> > a;
  for (i = 0; i < n; i++) {
    long long x;
    cin >> x;
    a.push_back(make_pair(x, i));
  }
  sort(a.begin(), a.end());
  vector<long long> b(n + 5);
  if (n == 2) {
    cout << 1 << "\n";
    return;
  }
  if (n == 3) {
    cout << 1 << "\n";
    return;
  }
  for (i = 1; i < n; i++) b[i - 1] = a[i].first - a[i - 1].first;
  bool f = true;
  for (i = 2; i < n - 1; i++) f &= b[i] == b[1];
  int ans = -1;
  if (f) {
    cout << a[0].second + 1 << "\n";
    return;
  }
  f = true;
  for (i = 2; i < n - 1; i++) f &= b[i] == a[2].first - a[0].first;
  if (f) {
    cout << a[1].second + 1 << "\n";
    return;
  }
  f = false;
  for (i = 1; i < n - 1; i++) {
    if (b[i] == b[0]) continue;
    if (f) {
      cout << -1;
      return;
    } else if (i == n - 2) {
      cout << a[i + 1].second + 1;
      return;
    } else if (a[i + 2].first - a[i].first == b[0]) {
      ans = a[i + 1].second;
      f = true;
      i++;
    } else {
      cout << -1;
      return;
    }
  }
  if (f)
    cout << ans + 1;
  else
    cout << a[n - 1].second + 1;
  return;
}
int main() {
  long long t = 1;
  while (t--) solve();
}
