#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int k = 0;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
    k += a.at(i);
    b.at(i) = a.at(i);
  }
  sort(b.begin(), b.end());
  if (b.at(0) == b.at(n - 1)) {
    cout << 0 << endl;
  } else {
    int h;
    int l = k;
    for (int i = 0; i < n; i++) {
      if (l <= n * b.at(i)) {
        k = b.at(i);
        h = b.at(i - 1);
        break;
      }
    }
    if (n * k - l < l - n * h) {
      k = k;
    } else {
      k = h;
    }
    h = -1;
    for (int i = 0; i < n; i++) {
      if (a.at(i) == k) {
        cout << i << endl;
        h = 0;
        break;
      }
    }
    if (h == -1) {
      cout << n - 1 << endl;
    }
  }
  return 0;
}
