#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MAX_N = 2e5 + 9;
pair<int, int> arr[MAX_N];
int n;
void solve(int a, int c) {
  int cur = 0, ans = -1;
  bool now = 0;
  for (int i = 0; i < n; i++) {
    if (a + c * (i - now) != arr[i].first) ans = arr[i].second, cur++, now = 1;
    if (cur > 1) return;
  }
  if (cur == 1) cout << ans, exit(0);
}
int32_t main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n;
  set<int> st;
  for (int i = 0; i < n; i++)
    cin >> arr[i].first, arr[i].second = i + 1, st.insert(arr[i].first);
  if (st.size() == 1 || n == 2) cout << 1, exit(0);
  sort(arr, arr + n);
  solve(arr[0].first, arr[1].first - arr[0].first);
  solve(arr[1].first, arr[2].first - arr[1].first);
  solve(arr[0].first, arr[2].first - arr[0].first);
  cout << -1;
}
