#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  pair<long long, long long> p[n + 3];
  long long i, j;
  for (i = 1; i <= n; ++i) cin >> p[i].first, p[i].second = i;
  sort(p + 1, p + n + 1);
  vector<long long> diff;
  for (i = 2; i <= n; ++i) diff.push_back(p[i].first - p[i - 1].first);
  if (n <= 3) {
    cout << 1;
    return 0;
  }
  long long sz = diff.size();
  for (i = 2; i <= sz - 1; ++i) {
    if (diff[i] != diff[i - 1]) break;
  }
  if (i == sz) {
    cout << p[1].second;
    return 0;
  }
  for (i = 1; i <= sz - 2; ++i) {
    if (diff[i] != diff[i - 1]) break;
  }
  if (i == sz - 1) {
    cout << p[n].second;
    return 0;
  }
  if (n == 4) {
    if (diff[0] == diff[1] + diff[2])
      cout << p[3].second;
    else if (diff[0] + diff[1] == diff[2])
      cout << p[2].second;
    else
      cout << -1;
    return 0;
  }
  for (i = 1; i <= sz - 3; ++i)
    if (diff[i] != diff[i - 1]) break;
  if (i == sz - 2 and diff[i] + diff[i + 1] == diff[i - 1]) {
    cout << p[n - 1].second;
    return 0;
  }
  for (i = sz - 2; i >= 2; --i)
    if (diff[i] != diff[i + 1]) break;
  if ((i == 1) and diff[i] + diff[i - 1] == diff[i + 1]) {
    cout << p[2].second;
    return 0;
  }
  vector<long long> ind;
  for (i = 1; i <= sz - 1; ++i)
    if (diff[i] != diff[i - 1]) ind.push_back(i);
  if (ind.size() >= 4) {
    cout << -1;
    return 0;
  }
  if (ind.size() == 3) {
    if (!(ind[1] == ind[0] + 1ll and ind[2] == ind[1] + 1ll)) {
      cout << -1;
      return 0;
    }
    if (diff[ind[0]] + diff[ind[1]] == diff[ind[2]]) {
      cout << p[ind[0] + 2].second;
      return 0;
    }
    cout << -1;
    return 0;
  } else if (ind.size() == 2) {
    if (!(ind[1] == ind[0] + 2ll)) {
      cout << -1;
      return 0;
    }
    if (2ll * diff[ind[0]] == diff[ind[1]]) {
      cout << p[ind[0] + 2].second;
      return 0;
    }
    cout << -1;
    return 0;
  }
  cout << -1;
  return 0;
}
