#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n;
  cin >> n;
  vector<pair<long long, long long> > arr(n);
  for (long long i = 0; i < n; i++) {
    cin >> arr[i].first;
    arr[i].second = i;
  }
  vector<long long> tm;
  sort(arr.begin(), arr.end());
  for (long long i = 0; i < n - 1; i++)
    tm.push_back(arr[i + 1].first - arr[i].first);
  long long p = 1;
  for (long long i = 1; i < n - 2; i++) {
    if (tm[i] != tm[i + 1]) {
      p = 0;
      break;
    }
  }
  if (p) {
    cout << arr[0].second + 1 << "\n";
    return 0;
  }
  p = 1;
  for (long long i = 0; i < n - 3; i++) {
    if (tm[i] != tm[i + 1]) {
      p = 0;
      break;
    }
  }
  if (p) {
    cout << arr[n - 1].second + 1 << "\n";
    return 0;
  }
  p = 1;
  long long d = 0, a = -1, m = *max_element(tm.begin(), tm.end());
  for (long long i = 0; i < tm.size() - 1; i++) {
    if (tm[i] != m && !d) {
      d = 1;
      if (tm[i] + tm[i + 1] == m) {
        a = arr[i + 1].second + 1;
        i++;
      } else {
        p = 0;
        break;
      }
    } else if (tm[i] != m && d) {
      p = 0;
      break;
    }
  }
  if (p)
    cout << a << "\n";
  else
    cout << -1 << "\n";
  return 0;
}
