#include <bits/stdc++.h>
using namespace std;
inline bool check(vector<pair<int64_t, int64_t> > &a) {
  for (int i = 1; i < a.size(); i++) {
    if (a[i].first - a[i - 1].first != a[1].first - a[0].first) return false;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int64_t n;
  cin >> n;
  vector<pair<int64_t, int64_t> > a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a.begin(), a.end());
  int64_t sum = 0;
  for (int i = 0; i < n; i++) sum += a[i].first;
  bool flag = false;
  if ((a[0].first + a[n - 1].first) * n / 2 == sum) {
    if (check(a)) {
      cout << a[0].second + 1 << "\n";
      flag = true;
    }
  }
  pair<int64_t, int64_t> tmp = a[n - 1];
  a.erase(a.begin() + n - 1);
  if (check(a) && !flag) {
    cout << tmp.second + 1 << "\n";
    flag = true;
  }
  a.insert(a.begin() + n - 1, tmp);
  if (!flag) {
    pair<int64_t, int64_t> tmp = a[0];
    a.erase(a.begin());
    if (check(a) && !flag) {
      cout << tmp.second + 1 << "\n";
      flag = true;
    }
    a.insert(a.begin(), tmp);
  }
  int64_t d = 0;
  for (int i = 0; i < n - 1; i++) d = max(d, a[i + 1].first - a[i].first);
  int cnt = 0;
  if (!flag) {
    for (int i = 0; i < n - 1; i++) {
      if (n > 10 && a[i + 1].first - a[i].first != d) {
        pair<int64_t, int64_t> tmp = a[i];
        a.erase(a.begin() + i);
        if (check(a)) {
          cout << tmp.second + 1 << "\n";
          flag = true;
          break;
        }
        a.insert(a.begin() + i, tmp);
        tmp = a[i + 1];
        a.erase(a.begin() + i + 1);
        if (check(a)) {
          cout << tmp.second + 1 << "\n";
          flag = true;
          break;
        }
        a.insert(a.begin() + i + 1, tmp);
        cnt++;
      } else if (n <= 10) {
        pair<int64_t, int64_t> tmp = a[i];
        a.erase(a.begin() + i);
        if (check(a)) {
          cout << tmp.second + 1 << "\n";
          flag = true;
          break;
        }
        a.insert(a.begin() + i, tmp);
      }
      if (n > 10 && cnt > 2) break;
    }
  }
  if (!flag) cout << "-1\n";
  return 0;
}
