#include <bits/stdc++.h>
using namespace std;
template <class A>
void pr(A a) {
  cout << a;
  cout << '\n';
}
template <class A, class B>
void pr(A a, B b) {
  cout << a << ' ';
  pr(b);
}
template <class A, class B, class C>
void pr(A a, B b, C c) {
  cout << a << ' ';
  pr(b, c);
}
template <class A, class B, class C, class D>
void pr(A a, B b, C c, D d) {
  cout << a << ' ';
  pr(b, c, d);
}
template <class A>
void PR(A a, long long n) {
  for (long long i = (long long)(0); i < (long long)(n); i++) {
    if (i) cout << ' ';
    cout << a[i];
  }
  cout << '\n';
}
long long check(long long n, long long m, long long x, long long y) {
  return x >= 0 && x < n && y >= 0 && y < m;
}
const long long MAX = 1e9 + 7, MAXL = 1LL << 61, dx[4] = {-1, 0, 1, 0},
                dy[4] = {0, 1, 0, -1};
bool ck(vector<long long> a) {
  set<long long> s;
  for (long long i = (long long)(0); i < (long long)(a.size() - 1); i++) {
    s.insert(a[i + 1] - a[i]);
  }
  return s.size() == 1;
}
void Main() {
  long long n;
  cin >> n;
  pair<long long, long long> a[n];
  for (long long i = (long long)(0); i < (long long)(n); i++) {
    cin >> a[i].first;
    a[i].second = i + 1;
  }
  sort(a, a + n);
  if (n <= 3) {
    pr(1);
    return;
  }
  {
    vector<long long> b;
    for (long long i = (long long)(1); i < (long long)(n); i++)
      b.push_back(a[i].first);
    if (ck(b)) {
      pr(a[0].second);
      return;
    }
  }
  {
    vector<long long> b;
    for (long long i = (long long)(0); i < (long long)(n - 1); i++)
      b.push_back(a[i].first);
    if (ck(b)) {
      pr(a[n - 1].second);
      return;
    }
  }
  if (n < 10) {
    for (long long j = (long long)(0); j < (long long)(n); j++) {
      vector<long long> b;
      for (long long i = (long long)(0); i < (long long)(n); i++) {
        if (i != j) b.push_back(a[i].first);
      }
      if (ck(b)) {
        pr(a[j].second);
        return;
      }
    }
  }
  map<long long, long long> m;
  map<long long, vector<long long> > ma;
  for (long long i = (long long)(0); i < (long long)(n - 1); i++) {
    long long x = a[i + 1].first - a[i].first;
    m[x]++;
    ma[x].push_back(i);
    ma[x].push_back(i + 1);
  }
  vector<pair<long long, long long> > p;
  for (__typeof((m).begin()) it = (m).begin(); it != (m).end(); it++)
    p.push_back(pair<long long, long long>(it->second, it->first));
  sort((p).begin(), (p).end());
  for (long long k = (long long)(0); k < (long long)(min((int)p.size(), 10));
       k++) {
    long long x = p[k].second;
    vector<long long> g = ma[x];
    for (long long j = (long long)(0); j < (long long)(min((int)g.size(), 10));
         j++) {
      vector<long long> b;
      for (long long i = (long long)(0); i < (long long)(n); i++) {
        if (i != g[j]) b.push_back(a[i].first);
      }
      if (ck(b)) {
        pr(a[g[j]].second);
        return;
      }
    }
  }
  pr(-1);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  Main();
  return 0;
}
