#include <bits/stdc++.h>
using namespace std;
long long int inf = (1e18 + 2);
vector<long long int> getUniqs(vector<long long int> vec) {
  sort((vec).begin(), (vec).end());
  auto itr = unique((vec).begin(), (vec).end());
  vec.resize(distance(vec.begin(), itr));
  return vec;
}
long long int ceill(long long int N, long long int K) {
  long long int res = N / K;
  long long int rem = N % K;
  if (rem != 0) res++;
  return res;
}
long long int modExp(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int l[200001];
long long int r[200001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  long long int b[n + 1];
  long long int ans = -1, sum = 0;
  vector<pair<long long int, long long int>> v;
  for (long long int i = 0; i < n; i++) {
    cin >> b[i];
    v.push_back(make_pair(b[i], i));
  }
  if (n <= 3) {
    cout << "1" << endl;
    return 0;
  }
  sort((v).begin(), (v).end());
  vector<long long int> diff;
  for (long long int i = 1; i < n; i++)
    diff.push_back(v[i].first - v[i - 1].first);
  set<long long int> s;
  for (long long int i = 0; i < (long long int)(diff.size()); i++) {
    s.insert(diff[i]);
    l[i] = (long long int)(s.size());
  }
  s.clear();
  long long int fi = diff[0];
  long long int la = diff.back();
  for (long long int i = (long long int)(diff.size()) - 1; i >= 0; i--) {
    s.insert(diff[i]);
    r[i] = (long long int)(s.size());
  }
  if (l[(long long int)(diff.size()) - 2] == 1) {
    cout << v.back().second + 1 << endl;
    return 0;
  }
  if (r[1] == 1) {
    cout << v[0].second + 1 << endl;
    return 0;
  }
  for (long long int i = 0; i < (long long int)(diff.size()) - 1; i++) {
    long long int club = diff[i] + diff[i + 1];
    if (i == (long long int)(diff.size()) - 2) {
      if (l[i - 1] == 1 && club == fi) {
        ans = v[i + 1].second + 1;
        break;
      }
    } else if (i == 0) {
      if (r[i + 2] == 1 && club == la) {
        ans = v[i + 1].second + 1;
        break;
      }
    } else {
      if (fi == la && club == fi && l[i - 1] == 1 && r[i + 2] == 1) {
        ans = v[i + 1].second + 1;
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
