#include <bits/stdc++.h>
using namespace std;
vector<pair<long long int, long long int> > arr;
bool fun(pair<long long int, long long int> fi,
         pair<long long int, long long int> se) {
  if (fi.first < se.first) {
    return true;
  } else
    return false;
}
void solve() {
  long long int i, j, k, l, m, n, x;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x;
    arr.push_back(make_pair(x, i + 1));
  }
  sort(arr.begin(), arr.end(), fun);
  if (n <= 3) {
    cout << 1 << endl;
    return;
  }
  long long int d = arr[1].first - arr[0].first;
  long long int count = 0;
  long long int index = arr[0].second;
  for (i = 0; i < n; i++) {
    if (arr[i].first != arr[0].first + (i - count) * d) {
      count++;
      index = arr[i].second;
      if (count > 1) {
        break;
      }
    }
  }
  if (count <= 1) {
    cout << index << endl;
    return;
  }
  d = arr[2].first - arr[0].first;
  count = 1;
  index = arr[1].second;
  for (i = 3; i < n; i++) {
    if (arr[i].first != arr[0].first + (i - count) * d) {
      count++;
      index = arr[i].second;
      if (count > 1) {
        break;
      }
    }
  }
  if (count <= 1) {
    cout << index << endl;
    return;
  }
  d = arr[2].first - arr[1].first;
  count = 1;
  index = arr[0].second;
  for (i = 3; i < n; i++) {
    if (arr[i].first != arr[1].first + (i - count) * d) {
      count++;
      index = arr[i].second;
      if (count > 1) {
        break;
      }
    }
  }
  if (count <= 1) {
    cout << index << endl;
    return;
  }
  cout << -1 << endl;
  return;
}
int main() {
  long long int t = 1;
  while (t--) {
    solve();
  }
}
