#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < (n); ++i) cin >> a[i];
  int sum = accumulate(a.begin(), a.end(), (int)0);
  sort(a.begin(), a.end());
  int frame_num = 0;
  int frame_min_dif = 1e8;
  for (int i = 0; i < (n); ++i) {
    int tmp_num = a[i] * n;
    int dif = abs(tmp_num - sum);
    if (dif < frame_min_dif) {
      frame_num = i;
      frame_min_dif = dif;
    }
  }
  cout << frame_num << endl;
  return 0;
}
