#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long t, n, i, j, k, l = 0, l1, l2, l3;
  cin >> n;
  vector<pair<long long, long long> > v;
  for (i = 1; i <= n; i++) {
    cin >> k;
    v.push_back({k, i});
  }
  sort(v.begin(), v.end());
  if (n == 2 || n == 3) {
    cout << "1";
    return 0;
  }
  map<long long, long long> m;
  for (i = 1; i < n; i++) m[v[i].first - v[i - 1].first]++;
  if (m.size() == 1) {
    cout << v[0].second;
    return 0;
  }
  j = v[1].first - v[0].first;
  m[j]--;
  if (m[j] == 0) m.erase(j);
  if (m.size() == 1) {
    cout << v[0].second;
    return 0;
  } else
    m[j]++;
  j = v[n - 1].first - v[n - 2].first;
  m[j]--;
  if (m[j] == 0) m.erase(j);
  if (m.size() == 1) {
    cout << v[n - 1].second;
    return 0;
  } else
    m[j]++;
  for (i = 1; i < n - 1; i++) {
    j = v[i + 1].first - v[i - 1].first;
    l1 = v[i].first - v[i - 1].first;
    l2 = v[i + 1].first - v[i].first;
    m[l1]--;
    m[l2]--;
    if (m[l1] == 0) {
      m.erase(l1);
    }
    if (m[l2] == 0) m.erase(l2);
    m[j]++;
    if (m.size() == 1) {
      cout << v[i].second;
      break;
    }
    m[l1]++;
    m[l2]++;
    m[j]--;
    if (m[j] == 0) m.erase(j);
  }
  if (i == (n - 1)) cout << "-1";
}
