#include <bits/stdc++.h>
using namespace std;
int main() {
  float n;
  cin >> n;
  vector<int> a(n), b(n);
  int l, r;
  float sum = 0.0;
  for (int i = 0; i < n; ++i) cin >> a[i], b[i] = a[i], sum += a[i];
  float ave = sum / n;
  sort(a.begin(), a.end());
  int temp_ans = 0, Temp_ans = 101, ans = 105;
  for (int i = 0; i < n; ++i) {
    if (ave < a[i]) {
      l = abs(ave - a[i - 1]);
      r = abs(ave - a[i]);
      if (l < r)
        temp_ans = a[i - 1];
      else if (l > r)
        temp_ans = a[i];
      else
        temp_ans = a[i], Temp_ans = a[i - 1];
      for (int i = 0; i < n; ++i) {
        if (temp_ans == b[i] || Temp_ans == b[i]) ans = min(ans, i);
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    if (temp_ans == b[i] || Temp_ans == b[i]) ans = min(ans, i);
  }
  cout << ans << endl;
}
