#include <bits/stdc++.h>
using namespace std;
const int INF = (1 << 30);
unsigned long long gcd(long long a, long long b) {
  return b == 0 ? a : gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
int main() {
  int n = 0;
  cin >> n;
  vector<pair<double, int>> numbers;
  double sum = 0;
  for (size_t i = 0; i < n; i++) {
    int x = 0;
    cin >> x;
    numbers.push_back(make_pair(x, i));
    sum += x;
  }
  sum = sum / n;
  for (size_t i = 0; i < numbers.size(); i++) {
    numbers[i].first = abs(numbers[i].first - sum);
  }
  sort(numbers.begin(), numbers.end());
  for (int i = 0; i < numbers.size(); i++) {
    if (numbers[i].first == 0) {
      cout << numbers[i].second << "\n";
      return 0;
    } else if (numbers[i].first > 0) {
      if (numbers[i].second > 0) {
        cout << numbers[i].second - 1 << "\n";
      } else {
        cout << 0 << "\n";
      }
      return 0;
    }
  }
  return 0;
}
