#include <bits/stdc++.h>
using namespace std;
int amount;
pair<int, int> numbers[200005];
int erase_spot = 1;
bool eraser(int par, int one) {
  int base = 0;
  int counter = 0;
  for (int i = 1; i <= amount; i++) {
    if (numbers[i].first != one + base)
      counter++, erase_spot = numbers[i].second;
    else
      base += par;
  }
  return (counter < 2);
}
void solve() {
  sort(numbers + 1, numbers + amount + 1);
  erase_spot = numbers[1].second;
  if (eraser(numbers[2].first - numbers[1].first, numbers[1].first))
    printf("%d", erase_spot);
  else if (eraser(numbers[3].first - numbers[1].first, numbers[1].first))
    printf("%d", erase_spot);
  else if (eraser(numbers[3].first - numbers[2].first, numbers[2].first))
    printf("%d", erase_spot);
  else
    printf("-1");
}
int main() {
  scanf("%d", &amount);
  for (int i = 1; i <= amount; i++)
    scanf("%d", &numbers[i].first), numbers[i].second = i;
  solve();
}
