#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, sum = 0;
  cin >> n;
  float a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum = sum + a[i];
  }
  float avg = sum / n;
  sort(a, a + n);
  int pos = -1, mi = INT_MAX;
  for (int i = n - 1; i >= 0; i--) {
    if (abs(avg - a[i] <= mi)) {
      mi = abs(avg - a[i]);
      pos = i;
    }
  }
  cout << pos << endl;
}
