#include <bits/stdc++.h>
using namespace std;
long long int power(long long int a, long long int b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long int r = power(a, b / 2) % 1000000007;
  if (b % 2 == 0)
    return (r * r) % 1000000007;
  else
    return (((r * r) % 1000000007) * a) % 1000000007;
}
int prime[1000009];
void sieve(int n) {
  prime[0] = prime[1] = 1;
  for (int i = 2; i <= sqrt(n); i++) {
    if (!prime[i]) {
      for (int j = 2 * i; j <= n; j++) {
        prime[j]++;
      }
    }
  }
}
bool comp(const pair<long long int, long long int> &a,
          const pair<long long int, long long int> &b) {
  return (a.second < b.second);
}
const int N = 5 * 1e5 + 9;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  long long int a[n];
  vector<pair<long long int, int> > v;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    v.push_back({a[i], i + 1});
  }
  sort(v.begin(), v.end());
  if (n == 2 || n == 3) {
    cout << "1\n";
    return 0;
  }
  map<long long int, long long int> mp;
  for (int i = 0; i < n - 1; i++) {
    mp[v[i + 1].first - v[i].first]++;
  }
  if (mp.size() > 3) {
    cout << "-1\n";
    return 0;
  }
  if (mp.size() == 1) {
    cout << v[0].second << "\n";
    return 0;
  }
  if (n == 4) {
    if (v[1].first + v[3].first == 2 * v[2].first) {
      cout << v[0].second << "\n";
      return 0;
    }
    if (v[0].first + v[3].first == 2 * v[2].first) {
      cout << v[1].second << "\n";
      return 0;
    }
    if (v[0].first + v[3].first == 2 * v[1].first) {
      cout << v[2].second << "\n";
      return 0;
    }
    if (v[0].first + v[2].first == 2 * v[1].first) {
      cout << v[3].second << "\n";
      return 0;
    }
    cout << "-1\n";
    return 0;
  }
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      mp[v[i + 1].first - v[i].first]--;
      if (mp[v[i + 1].first - v[i].first] == 0) {
        mp.erase(v[i + 1].first - v[i].first);
      }
      if (mp.size() == 1) {
        cout << v[0].second << "\n";
        return 0;
      }
      mp[v[i + 1].first - v[i].first]++;
    } else if (i == n - 1) {
      mp[v[i].first - v[i - 1].first]--;
      if (mp[v[i].first - v[i - 1].first] == 0) {
        mp.erase(v[i].first - v[i - 1].first);
      }
      if (mp.size() == 1) {
        cout << v[n - 1].second << "\n";
        return 0;
      }
      mp[v[i].first - v[i - 1].first]++;
    } else {
      mp[v[i + 1].first - v[i].first]--;
      mp[v[i].first - v[i - 1].first]--;
      if (mp[v[i + 1].first - v[i].first] == 0) {
        mp.erase(v[i + 1].first - v[i].first);
      }
      if (mp[v[i].first - v[i - 1].first] == 0) {
        mp.erase(v[i].first - v[i - 1].first);
      }
      mp[v[i + 1].first - v[i - 1].first]++;
      if (mp.size() == 1) {
        cout << v[i].second << "\n";
        return 0;
      }
      mp[v[i + 1].first - v[i - 1].first]--;
      if (mp[v[i + 1].first - v[i - 1].first] == 0) {
        mp.erase(v[i + 1].first - v[i - 1].first);
      }
      mp[v[i + 1].first - v[i].first]++;
      mp[v[i].first - v[i - 1].first]++;
    }
  }
  cout << "-1\n";
  return 0;
}
