#include <bits/stdc++.h>
using namespace std;
std::vector<long long> a;
std::map<long long, long long> pos, check1;
set<long long> diff;
std::vector<long long> t1;
int expo(int base, int exponent, int mod) {
  int ans = 1;
  while (exponent != 0) {
    if (exponent & 1) ans = (1LL * ans * base) % mod;
    base = (1LL * base * base) % mod;
    exponent >>= 1;
  }
  return ans % mod;
}
long long expo1(long long base, long long exponent, long long mod) {
  long long ans = 1;
  while (exponent != 0) {
    if ((exponent & 1) == 1) {
      ans = ans * base;
      ans = ans % mod;
    }
    base = base * base;
    base %= mod;
    exponent >>= 1;
  }
  return ans % mod;
}
long long expo3(long long base, long long exponent, long long mod) {
  long long ans = 1;
  while (exponent != 0) {
    if ((exponent & 1) == 1) {
      ans = ans * base;
      ans = ans % mod;
    }
    base = base * base;
    base %= mod;
    exponent >>= 1;
  }
  return ans % mod;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  if (n == 2 || n == 3) {
    cout << "1";
    exit(0);
  }
  for (long long int iii = 0; iii < 10; iii++) {
    long long xxx;
  }
  for (long long int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    a.push_back(x);
    pos[x] = i + 1;
    check1[x]++;
  }
  sort((a).begin(), (a).end());
  for (long long int iii = 0; iii < 10; iii++) {
    long long xxx;
  }
  for (long long int i = 2; i < n; i++) {
    diff.insert(a[i] - a[i - 1]);
  }
  if (diff.size() == 1) {
    cout << pos[a[0]];
    exit(0);
  }
  for (long long int iii = 0; iii < 10; iii++) {
    long long xxx;
  }
  long long s0, s1;
  s0 = a[0];
  diff.clear();
  diff.insert(a[2] - a[0]);
  for (long long int i = 3; i < n; i++) {
    diff.insert(a[i] - a[i - 1]);
  }
  if (diff.size() == 1) {
    cout << pos[a[1]];
    exit(0);
  }
  for (long long int iii = 0; iii < 10; iii++) {
    long long xxx;
  }
  s1 = a[1];
  t1.push_back(s0);
  t1.push_back(s1);
  long long dd = (s1 - s0);
  for (long long int i = 0; i < n - 3; i++) {
    t1.push_back(t1[t1.size() - 1] + dd);
  }
  std::map<long long, long long> check;
  for (long long int iii = 0; iii < 10; iii++) {
    long long xxx;
  }
  for (auto i : t1) {
    check[i]++;
  }
  long long cnt = 0;
  long long vl = -1;
  for (long long int iii = 0; iii < 10; iii++) {
    long long xxx;
  }
  for (auto i : check1) {
    if (check1[i.first] != check[i.first]) {
      if (abs(check1[i.first] - check[i.first]) == 1) {
        cnt++;
        vl = i.first;
      } else {
        cnt += 10;
      }
    }
  }
  if (cnt == 1) {
    cout << pos[vl];
  } else
    cout << "-1";
}
