#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const double eps = 1e-9;
const int maxn = 200005;
int d[maxn], _d[maxn];
bool ok[maxn], _ok[maxn];
pair<int, int> v[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> v[i].first;
    v[i].second = i;
  }
  sort(v + 1, v + 1 + n);
  ok[1] = true;
  ok[2] = true;
  d[2] = v[2].first - v[1].first;
  for (int i = 3; i <= n; i++) {
    if (ok[i - 1] && v[i].first - v[i - 1].first == d[i - 1]) {
      ok[i] = true;
      d[i] = d[i - 1];
    } else
      break;
  }
  _ok[n] = true;
  _ok[n - 1] = true;
  _d[n - 1] = v[n].first - v[n - 1].first;
  for (int i = n - 2; i >= 1; i--) {
    if (_ok[i + 1] && v[i + 1].first - v[i].first == _d[i + 1]) {
      _ok[i] = true;
      _d[i] = _d[i + 1];
    } else
      break;
  }
  if (_ok[2]) {
    cout << v[1].second << '\n';
    return 0;
  }
  if (ok[n - 1]) {
    cout << v[n].second << '\n';
    return 0;
  }
  for (int i = 2; i < n; i++) {
    if (!ok[i - 1] || !_ok[i + 1]) continue;
    int di = v[i + 1].first - v[i - 1].first;
    if (di != d[i - 1] && i > 2) continue;
    if (di != _d[i + 1] && i < n - 1) continue;
    cout << v[i].second << '\n';
    return 0;
  }
  cout << -1 << '\n';
  return 0;
}
