#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  long long arr[n];
  unordered_map<long long, long long> idx;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
    idx[arr[i]] = i;
  }
  sort(arr, arr + n);
  long long mini = arr[0];
  long long maxi = arr[n - 1];
  if (n == 2) {
    cout << 1;
    exit(0);
  } else {
    long long d = arr[2] - arr[1];
    bool fl = false;
    for (long long i = 3; i < n; i++) {
      if (arr[i] - arr[i - 1] != d) {
        fl = true;
        break;
      }
    }
    if (!fl) {
      cout << idx[mini] + 1;
      exit(0);
    } else {
      long long d = arr[n - 2] - arr[n - 3];
      bool fl1 = false;
      for (long long i = n - 3; i >= 1; i--) {
        if (arr[i] - arr[i - 1] != d) {
          fl1 = true;
          break;
        }
      }
      if (!fl1) {
        cout << idx[maxi] + 1;
      } else {
        unordered_map<long long, bool> diff;
        vector<long long> v;
        v.push_back(arr[0]);
        long long maxd = -1;
        for (long long i = 1; i < n - 1; i++) {
          long long d1 = arr[i] - arr[i - 1];
          long long d2 = arr[i + 1] - arr[i];
          maxd = max(maxd, max(d1, d2));
          diff[d1] = true;
          diff[d2] = true;
        }
        long long x = INT_MIN;
        long long cnt = 0;
        for (long long i = 1; i < n - 1; i++) {
          long long d1 = arr[i] - arr[i - 1];
          long long d2 = arr[i + 1] - arr[i];
          if (d1 <= maxd && d2 <= maxd && d1 + d2 == maxd && cnt == 0) {
            x = arr[i];
            cnt = 1;
            continue;
          } else
            v.push_back(arr[i]);
        }
        v.push_back(arr[n - 1]);
        bool fl2 = false;
        long long D = v[1] - v[0];
        for (long long i = 2; i < v.size(); i++) {
          if (v[i] - v[i - 1] != D) {
            fl2 = true;
            break;
          }
        }
        if (fl2) {
          cout << -1;
          exit(0);
        } else {
          if (x != INT_MIN)
            cout << idx[x] + 1;
          else
            cout << -1;
          return 0;
        }
      }
    }
  }
  return 0;
}
