#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  (cin >> N);
  vector<int> a(N);
  int sum = 0;
  for (int i = 0; i != N; ++i) {
    (cin >> a[i]);
    sum += a[i];
  }
  sum /= N;
  int min = 0, n = 0;
  for (int i = 0; i != N; ++i) {
    if ((sum - n < 0 ? -sum - n : sum - n) >
        (sum - a[i] < 0 ? -sum - a[i] : sum - a[i])) {
      min = i;
      n = a[i];
    }
  }
  (cout << min - 1 << "\n");
}
