#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
void solve() {
  int N;
  cin >> N;
  double mean = 0;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    mean += a[i];
  }
  mean /= N;
  sort((a).begin(), (a).end());
  int flame = 0;
  double mindiff = 100000;
  for (int i = 0; i < N; i++) {
    if (mindiff > abs(mean - a[i])) {
      mindiff = abs(mean - a[i]);
      flame = i;
    }
  }
  cout << flame << endl;
  return;
}
int main(int argc, char const* argv[]) {
  solve();
  return 0;
}
