#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<double> vec(N);
  int count = 0;
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
    count += vec.at(i);
  }
  double ave;
  ave = (double)count / N;
  int number = N - 1;
  for (int i = N - 1; i > 0; i--) {
    double a =
        min(abs((double)vec.at(i) - ave), abs((double)vec.at(i - 1) - ave));
    if (a == abs((double)vec.at(i - 1) - ave)) {
      number = i - 1;
    }
  }
  cout << number << endl;
}
