#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int MOD2 = MOD + 2;
const int INF = (int)1e9;
const long long LINF = (long long)1e18;
const long double PI = acos((long double)-1);
const long double EPS = 1e-9;
inline long long gcd(long long a, long long b) {
  long long r;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
inline long long fpow(long long n, long long k, int p = MOD) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
template <class T>
inline int chkmin(T& a, const T& val) {
  return val < a ? a = val, 1 : 0;
}
template <class T>
inline int chkmax(T& a, const T& val) {
  return a < val ? a = val, 1 : 0;
}
inline long long isqrt(long long k) {
  long long r = sqrt(k) + 1;
  while (r * r > k) r--;
  return r;
}
inline long long icbrt(long long k) {
  long long r = cbrt(k) + 1;
  while (r * r * r > k) r--;
  return r;
}
inline void addmod(int& a, int val, int p = MOD) {
  if ((a = (a + val)) >= p) a -= p;
}
inline void submod(int& a, int val, int p = MOD) {
  if ((a = (a - val)) < 0) a += p;
}
inline int mult(int a, int b, int p = MOD) { return (long long)a * b % p; }
inline int inv(int a, int p = MOD) { return fpow(a, p - 2, p); }
inline int sign(long double x) { return x < -EPS ? -1 : x > +EPS; }
inline int sign(long double x, long double y) { return sign(x - y); }
int modulo(int a, int b) { return (a % b + b) % b; }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  vector<pair<int, int> > b(n);
  for (int i = (0); i <= (n - 1); i++) {
    cin >> b[i].first;
    b[i].second = i;
  }
  sort(b.begin(), b.end());
  if (n <= 3) {
    cout << 1 << "\n";
    return 0;
  }
  set<long long> s;
  map<long long, long long> freq;
  for (int i = (0); i <= (n - 2); i++) {
    long long diff = b[i + 1].first - b[i].first;
    s.insert(diff);
    freq[diff]++;
  }
  if ((long long)s.size() > 5) {
    cout << -1 << "\n";
    return 0;
  }
  long long ans = -1;
  for (int i = (0); i <= (n - 1); i++) {
    long long prev = -1, next = -1, prevdiff = -1, nextdiff = -1;
    if (i > 0) {
      prevdiff = b[i].first - b[i - 1].first;
      prev = b[i - 1].first;
      freq[prevdiff]--;
    }
    if (i + 1 < n) {
      nextdiff = b[i + 1].first - b[i].first;
      next = b[i + 1].first;
      freq[nextdiff]--;
    }
    if (i > 0 && i + 1 < n) {
      freq[next - prev]++;
    }
    long long cnt = 0;
    for (auto p : freq) {
      if (p.second > 0) {
        cnt++;
      }
    }
    if (cnt == 1) {
      ans = b[i].second + 1;
      break;
    } else {
      if (prevdiff != -1) freq[prevdiff]++;
      if (nextdiff != -1) freq[nextdiff]++;
      if (i > 0 && i + 1 < n) {
        freq[next - prev]--;
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
