#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n + 1);
  if (n > 0) {
    long long sum = 0;
    double average = 0;
    for (int i = 0; i < n; i++) {
      cin >> v[i];
    }
    for (auto x : v) sum += x;
    average = sum / (double)n;
    int diff = average - v[0];
    int closeToAverage = (diff >= 0) ? diff : diff * -1;
    int pos = 0;
    for (int i = 1; i < n; i++) {
      diff = (average - v[i]);
      diff = (diff >= 0) ? diff : diff * -1;
      if (diff < closeToAverage) {
        closeToAverage = diff;
        pos = i;
      }
    }
    cout << pos << "\n";
  } else {
    cout << "-1"
         << "\n";
  }
  return 0;
}
