#include <bits/stdc++.h>
using namespace std;
#pragma GCC push_options
#pragma GCC optimize("unroll-loops")
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long ar[n];
  map<long long, long long> m;
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
    m[ar[i]] = i + 1;
  }
  if (n <= 3) {
    cout << 1 << "\n";
    return 0;
  }
  sort(ar, ar + n);
  long long d = ar[2] - ar[1];
  bool flag = true;
  for (int i = 3; i < n; i++) {
    if (ar[i] - ar[i - 1] != d) {
      flag = false;
      break;
    }
  }
  if (flag) {
    cout << m[ar[0]] << "\n";
    return 0;
  }
  d = ar[2] - ar[0];
  flag = true;
  for (int i = 3; i < n; i++) {
    if (ar[i] - ar[i - 1] != d) {
      flag = false;
      break;
    }
  }
  if (flag) {
    cout << m[ar[1]] << "\n";
    return 0;
  }
  d = ar[1] - ar[0];
  long long ashu = LLONG_MIN;
  flag = true;
  for (int i = 2; i < n; i++) {
    long long val = ar[i] - ar[i - 1];
    if (val != d) {
      if (ashu != LLONG_MIN) {
        flag = false;
        break;
      } else {
        ashu = ar[i];
        ar[i] = ar[i - 1];
      }
    }
  }
  if (flag) {
    cout << m[ashu] << "\n";
  } else
    cout << -1 << "\n";
  return 0;
}
