#include <bits/stdc++.h>
using namespace std;
const long long int inf = 1e18;
const long long int mod = 1e9 + 7;
inline long long int add(long long int x, long long int y) {
  x += y;
  if (x >= mod) x -= mod;
  return x;
}
inline long long int sub(long long int x, long long int y) {
  x -= y;
  if (x < 0) x += mod;
  return x;
}
inline long long int mul(long long int x, long long int y) {
  return ((x % mod) * (y % mod)) % mod;
}
inline long long int power(long long int a, long long int b) {
  long long int x = 1;
  while (b) {
    if (b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline long long int inv(long long int a) { return power(a, mod - 2); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  if (n <= 3) {
    cout << 1 << endl;
    return 0;
  }
  pair<int, int> a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i + 1;
  }
  sort(a, a + n);
  int d1 = a[1].first - a[0].first, d2 = a[2].first - a[0].first,
      d3 = a[2].first - a[1].first;
  vector<int> p, q, r;
  int pre = a[0].first;
  for (int i = 1; i < n; i++) {
    if (pre + d1 == a[i].first)
      pre += d1;
    else
      p.push_back(a[i].second);
  }
  pre = a[0].first;
  for (int i = 1; i < n; i++) {
    if (pre + d2 == a[i].first)
      pre += d2;
    else
      q.push_back(a[i].second);
  }
  pre = a[1].first;
  r.push_back(a[0].second);
  for (int i = 2; i < n; i++) {
    if (pre + d3 == a[i].first)
      pre += d3;
    else
      r.push_back(a[i].second);
  }
  if (p.size() == 1) {
    cout << p[0] << endl;
  } else if (q.size() == 1) {
    cout << q[0] << endl;
  } else if (r.size() == 1) {
    cout << r[0] << endl;
  } else {
    if (p.size() == 0 || q.size() == 0 || r.size() == 0)
      cout << 1 << endl;
    else
      cout << -1 << endl;
  }
  return 0;
}
