#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  int num;
  cin >> n;
  int a[n];
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> num;
    a[i] = num;
    sum += num;
  }
  double mean = sum / n;
  int before_sort[n];
  for (int i = 0; i < n; i++) {
    before_sort[i] = a[i];
  }
  sort(a, a + n);
  int mean_num;
  int i = 0;
  for (; i < n; i++) {
    if (mean <= a[i]) {
      mean_num = a[i];
      if (mean_num - mean > mean - a[i - 1]) {
        mean_num = a[i - 1];
      }
      break;
    }
  }
  for (int i = 0; i < n; i++) {
    if (mean_num == a[i]) {
      cout << i;
      return i;
    }
  }
}
