#include <bits/stdc++.h>
using namespace std;
inline long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
inline long long int lcm(long long int a, long long int b) {
  return a / gcd(a, b) * b;
}
int moth[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int dir[4][2] = {1, 0, 0, 1, -1, 0, 0, -1};
int dirs[8][2] = {1, 0, 0, 1, -1, 0, 0, -1, -1, -1, -1, 1, 1, -1, 1, 1};
const int inf = 0x3f3f3f3f;
const long long int mod = 1e9 + 7;
struct node {
  int v, id;
  friend bool operator<(node a, node b) { return a.v < b.v; }
};
node a[200007];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].v;
    a[i].id = i;
  }
  sort(a + 1, a + 1 + n);
  set<int> s;
  map<int, int> m;
  for (int i = 2; i <= n; i++) {
    s.insert(a[i].v - a[i - 1].v);
    m[a[i].v - a[i - 1].v]++;
  }
  int maxx = -inf;
  int maxv = -inf;
  for (auto i = m.begin(); i != m.end(); i++) {
    if ((i->second) >= maxv) {
      if (i->second == maxv) {
        if (i->first > maxx) {
          maxx = i->first;
        }
      } else {
        maxv = i->second;
        maxx = i->first;
      }
    }
  }
  if (s.size() == 2 || s.size() == 3) {
    int index;
    for (int i = 2; i <= n; i++) {
      if (a[i].v - a[i - 1].v != maxx) {
        index = i;
        break;
      }
    }
    bool f = 1;
    if (index == 2) {
      for (int i = 3; i <= n; i++) {
        if (a[i].v - a[i - 1].v != maxx) {
          f = 0;
          break;
        }
      }
      if (f)
        index = 1;
      else {
        f = 1;
        for (int i = 2; i <= n; i++) {
          if (i == index) continue;
          if (i - 1 == index) {
            if (a[i].v - a[i - 2].v != maxx) {
              f = 0;
              break;
            }
          } else {
            if (a[i].v - a[i - 1].v != maxx) {
              f = 0;
              break;
            }
          }
        }
      }
    } else {
      for (int i = 2; i <= n; i++) {
        if (i == index) continue;
        if (i - 1 == index) {
          if (a[i].v - a[i - 2].v != maxx) {
            f = 0;
            break;
          }
        } else {
          if (a[i].v - a[i - 1].v != maxx) {
            f = 0;
            break;
          }
        }
      }
    }
    if (f)
      cout << a[index].id << endl;
    else
      cout << "-1" << endl;
  } else {
    if (s.size() == 1)
      cout << a[1].id << endl;
    else
      cout << "-1" << endl;
  }
  return 0;
}
