#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[100];
  int sum;
  int i = 0;
  while (i < n) {
    cin >> a[i];
    sum += a[i];
    i++;
  }
  int ii = 0;
  while (true) {
    i = 0;
    while (i < n) {
      if (abs(n * a[i] - sum) == ii) {
        i--;
        cout << i << endl;
        goto abc;
      }
      i++;
    }
    ii++;
  }
abc:
  return 0;
}
