#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
const int maxnn = 1e6 + 5;
int mod = 1e9 + 7;
long long inf = 0x3f3f3f3f;
long long ese = 1e-6;
vector<int> vec[30];
map<long long, int> s;
map<long long, int>::iterator it;
struct Node {
  long long n;
  int num;
} ans[maxn];
bool cmp(struct Node a, struct Node b) { return a.n < b.n; }
long long a[maxn];
long long mulit(long long base, long long k) {
  long long ans = 1;
  while (k) {
    if (k & 1) ans = base * ans % mod;
    base = base * base % mod;
    k >>= 1;
  }
  return ans % mod;
}
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> ans[i].n;
    ans[i].num = i + 1;
  }
  sort(ans, ans + n, cmp);
  if (s.size() > 3) {
    cout << "-1\n";
    return 0;
  }
  long long cd = ans[1].n - ans[0].n;
  long long be = ans[0].n;
  int cnt = 0, flag = 0;
  for (int i = 0; i < n; ++i) {
    if (ans[i].n == be + cnt * cd)
      cnt++;
    else
      flag = ans[i].num;
  }
  if (cnt == n - 1) {
    cout << flag << "\n";
    return 0;
  }
  cd = ans[2].n - ans[0].n;
  be = ans[0].n;
  cnt = 1, flag = ans[1].num;
  for (int i = 2; i < n; ++i) {
    if (ans[i].n == be + cnt * cd)
      cnt++;
    else
      flag = ans[i].num;
  }
  if (cnt == n - 1) {
    cout << flag << "\n";
    return 0;
  }
  cd = ans[2].n - ans[1].n;
  be = ans[1].n;
  cnt = 0, flag = ans[0].num;
  for (int i = 1; i < n; ++i) {
    if (ans[i].n == be + cnt * cd)
      cnt++;
    else
      flag = ans[i].num;
  }
  if (cnt == n - 1) {
    cout << flag << "\n";
    return 0;
  }
  cout << "-1\n";
  return 0;
}
