#include <bits/stdc++.h>
using namespace std;
const int NMAX = 200010;
pair<int, int> v[NMAX];
int val[NMAX];
bool okst[NMAX];
bool okdr[NMAX];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  if (n <= 3) {
    cout << 1 << endl;
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    cin >> v[i].first;
    v[i].second = i;
  }
  sort(v + 1, v + n + 1);
  for (int i = 1; i <= n; i++) val[i] = v[i].first;
  okst[1] = okdr[n] = 1;
  okst[2] = okdr[n - 1] = 1;
  for (int i = 3; i <= n; i++)
    okst[i] = (okst[i - 1] && val[i] - val[i - 1] == val[i - 1] - val[i - 2]);
  for (int i = n - 2; i >= 1; i--)
    okdr[i] = (okdr[i + 1] && val[i + 1] - val[i] == val[i + 2] - val[i + 1]);
  if (okdr[2]) {
    cout << v[1].second << "\n";
    return 0;
  }
  if (okst[n - 1]) {
    cout << v[n].second << "\n";
    return 0;
  }
  if (okdr[3] && val[4] - val[3] == val[3] - val[1]) {
    cout << v[2].second << '\n';
    return 0;
  }
  if (okst[n - 2] && val[n] - val[n - 2] == val[2] - val[1]) {
    cout << v[n - 1].second << '\n';
    return 0;
  }
  for (int i = 3; i + 1 < n; i++) {
    int passt = val[2] - val[1];
    int pasdr = val[n] - val[n - 1];
    if (okst[i - 1] && okdr[i + 1] && passt == pasdr &&
        passt == val[i + 1] - val[i - 1]) {
      cout << v[i].second << '\n';
      return 0;
    }
  }
  cout << "-1\n";
  return 0;
}
