#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long inf = 4e18;
const long long N = 5e5 + 5;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long tt = 1;
  while (tt--) {
    long long n;
    cin >> n;
    vector<pair<long long, long long>> arr(n);
    for (long long i = 0; i < n; ++i) {
      long long x;
      cin >> x;
      arr[i] = make_pair(x, i);
    }
    sort(arr.begin(), arr.end());
    if (n < 4) {
      cout << 1 << "\n";
      return 0;
    }
    vector<long long> dif(n - 1);
    for (long long i = 1; i < n; ++i)
      dif[i - 1] = arr[i].first - arr[i - 1].first;
    bool flag = true;
    for (long long i = 2; i < n - 1; ++i) {
      flag &= (dif[i] == dif[1]);
    }
    if (flag) {
      cout << arr[0].second + 1;
      return 0;
    }
    flag = true;
    for (long long i = 2; i < n - 1; ++i) {
      flag &= (dif[i] == arr[2].first - arr[0].first);
    }
    if (flag) {
      cout << arr[1].second + 1;
      return 0;
    }
    flag = false;
    long long ans = -10;
    for (long long i = 1; i < n - 1; ++i) {
      if (dif[0] == dif[i]) continue;
      if (flag) {
        cout << -1 << "\n";
        return 0;
      } else {
        if (i == n - 2) {
          cout << arr[n - 1].second + 1 << "\n";
          return 0;
        }
        if (arr[i + 2].first - arr[i].first == dif[0]) {
          ans = arr[i + 1].second;
          ++i;
          flag = true;
        } else {
          cout << "-1"
               << "\n";
          return 0;
        }
      }
    }
    if (flag)
      cout << ans + 1 << "\n";
    else
      cout << arr[n - 1].second + 1;
  }
  return 0;
}
