#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  pair<long long, long long> arr[n];
  for (long long i = 0; i < n; i++) cin >> arr[i].first, arr[i].second = i;
  if (n <= 3) {
    cout << 1;
    return 0;
  }
  sort(arr, arr + n);
  long long d = arr[2].first - arr[1].first;
  bool flag = true;
  for (long long i = 2; i < n; i++) {
    if (arr[i].first - arr[i - 1].first == d)
      continue;
    else {
      flag = false;
      break;
    }
  }
  if (flag) {
    cout << arr[0].second + 1;
    return 0;
  }
  flag = true;
  d = arr[2].first - arr[0].first;
  for (long long i = 3; i < n; i++) {
    if (arr[i].first - arr[i - 1].first == d)
      continue;
    else {
      flag = false;
      break;
    }
  }
  if (flag) {
    cout << arr[1].second + 1;
    return 0;
  }
  d = arr[1].first - arr[0].first;
  flag = true;
  long long last = arr[0].first;
  long long ans = -1;
  for (long long i = 1; i < n; i++) {
    if (arr[i].first - last != d) {
      if (!flag) {
        cout << -1;
        return 0;
      } else {
        flag = false;
        ans = arr[i].second + 1;
        continue;
      }
    }
    last = arr[i].first;
  }
  assert(flag == false);
  cout << ans;
  return 0;
}
