#include <bits/stdc++.h>
using namespace std;
const int maxn = 200020;
int idx[maxn], n;
long long a[maxn];
bool cmp(int i, int j) { return a[i] < a[j]; }
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    idx[i] = i;
  }
  sort(idx + 1, idx + n + 1, cmp);
  if (n <= 3) {
    puts("1");
    return 0;
  }
  bool flag = true;
  long long d = a[idx[3]] - a[idx[1]];
  for (int i = 4; i <= n; i++)
    if (a[idx[i]] - a[idx[i - 1]] != d) {
      flag = false;
      break;
    }
  if (flag == true) {
    cout << idx[2] << endl;
    return 0;
  }
  flag = true;
  d = a[idx[3]] - a[idx[2]];
  for (int i = 4; i <= n; i++)
    if (a[idx[i]] - a[idx[i - 1]] != d) {
      flag = false;
      break;
    }
  if (flag == true) {
    cout << idx[1] << endl;
    return 0;
  }
  d = a[idx[2]] - a[idx[1]];
  int ii = -1;
  for (int i = 3; i <= n; i++) {
    if (a[idx[i]] - a[idx[i - 1]] != d) {
      ii = i;
      break;
    }
  }
  if (ii == -1 || ii == n) {
    cout << idx[n] << endl;
    return 0;
  }
  if (a[idx[ii + 1]] - a[idx[ii - 1]] != d) {
    puts("-1");
    return 0;
  }
  flag = true;
  for (int i = ii + 2; i <= n; i++)
    if (a[idx[i]] - a[idx[i - 1]] != d) {
      puts("-1");
      return 0;
    }
  cout << idx[ii] << endl;
  return 0;
}
