#include <bits/stdc++.h>
using namespace std;
void print(vector<long long> v) {
  long long n = v.size();
  for (long long i = 0; i < n; i++) {
    cout << v[i] << " ";
  }
}
long long power(long long a, long long b) {
  long long res = 1;
  while (b != 0) {
    if (b & 1) {
      res *= a;
    }
    a = (a * a);
    b = (b / 2);
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) {
    cin >> v[i];
  }
  if (n <= 3) {
    cout << 1;
    return 0;
  }
  vector<long long> v1 = v;
  sort(v1.begin(), v1.end());
  vector<long long> diff;
  map<long long, vector<long long> > mp;
  for (long long i = 1; i < n; i++) {
    diff.push_back(v1[i] - v1[i - 1]);
    mp[diff[i - 1]].push_back(i);
  }
  if (mp.size() > 3) {
    cout << -1;
    return 0;
  }
  if (mp.size() == 1) {
    for (long long i = 0; i < n; i++) {
      if (v[i] == v1[0]) {
        cout << i + 1;
        return 0;
      }
    }
  }
  if (mp.size() == 2) {
    auto it = mp.begin();
    vector<long long> v2 = it->second;
    if (v2.size() == 1) {
      long long x = v2[0], y;
      if (x == 1) y = v1[0];
      if (x == n - 1) y = v1[x];
      if (x == 1 || x == n - 1) {
        for (long long i = 0; i < n; i++) {
          if (v[i] == y) {
            cout << i + 1;
            return 0;
          }
        }
      }
      if (it->first == 0) {
        long long y = v1[v2[0]];
        for (long long i = 0; i < n; i++) {
          if (v[i] == y) {
            cout << i + 1;
            return 0;
          }
        }
      }
    }
    if (v2.size() == 2) {
      auto it2 = it;
      it2++;
      if (v2[1] - v2[0] == 1 && it->first * 2 == it2->first) {
        long long x = v2[0], y;
        y = v1[x];
        for (long long i = 0; i < n; i++) {
          if (v[i] == y) {
            cout << i + 1;
            return 0;
          }
        }
      }
    }
    it++;
    v2 = it->second;
    if (v2.size() == 1) {
      long long x = v2[0], y;
      if (x == 1) y = v1[0];
      if (x == n - 1) y = v1[x];
      if (x == 1 || x == n - 1) {
        for (long long i = 0; i < n; i++) {
          if (v[i] == y) {
            cout << i + 1;
            return 0;
          }
        }
      }
    }
    if (v2.size() == 2) {
      auto it2 = it;
      it2++;
      if (v2[1] - v2[0] == 1 && it->first * 2 == it2->first) {
        long long x = v2[0], y;
        y = v1[x];
        for (long long i = 0; i < n; i++) {
          if (v[i] == y) {
            cout << i + 1;
            return 0;
          }
        }
      }
    }
  }
  if (mp.size() == 3) {
    auto it = mp.begin();
    auto it1 = it;
    it1++;
    auto it2 = it1;
    it2++;
    if (it->first + it1->first == it2->first) {
      if (abs(it->second[0] - it1->second[0]) == 1) {
        long long x1 = it->second[0], x2 = it1->second[0];
        long long x = min(x1, x2);
        long long y = v1[x];
        for (long long i = 0; i < n; i++) {
          if (v[i] == y) {
            cout << i + 1;
            return 0;
          }
        }
      }
    }
  }
  cout << -1;
  return 0;
}
