#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  if (n < 4) {
    cout << 1;
    return 0;
  }
  pair<int, int> p[n];
  for (int i = 0; i < n; i++) {
    cin >> p[i].first;
    p[i].second = i + 1;
  }
  sort(p, p + n);
  vector<int> diff;
  set<int> s;
  map<int, int> mp;
  for (int i = 0; i < n - 1; i++) {
    diff.push_back(p[i + 1].first - p[i].first);
    s.insert(diff.back());
    mp[diff.back()]++;
  }
  if (s.size() == 1) {
    cout << p[0].second;
    return 0;
  }
  sort(diff.begin(), diff.end());
  map<int, int>::iterator it1 = mp.begin(), it2 = it1;
  it2++;
  int check = -1;
  if (it1->second > it2->second && it2->second == 1) {
    check = it2->first;
  } else if (it1->second < it2->second && it1->second == 1)
    check = it1->first;
  if (s.size() == 2 && check != -1) {
    if (p[1].first - p[0].first == check) {
      cout << p[0].second;
      return 0;
    } else if (p[n - 1].first - p[n - 2].first == check) {
      cout << p[n - 1].second;
      return 0;
    }
  }
  int sum = diff[0] + diff[1];
  bool flag = 1;
  for (int i = 2; i < diff.size(); i++) {
    if (diff[i] != sum) flag = 0;
  }
  if (!flag) {
    cout << -1;
    return 0;
  }
  for (int i = 1; i < n - 1; i++) {
    if (p[i].first - p[i - 1].first == diff[0] &&
        p[i + 1].first - p[i].first == diff[1]) {
      cout << p[i].second;
      return 0;
    } else if (p[i].first - p[i - 1].first == diff[1] &&
               p[i + 1].first - p[i].first == diff[0]) {
      cout << p[i].second;
      return 0;
    }
  }
}
