#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int s = 0;
  for (int i = 0; i < n; i++) {
    s += a[i];
  }
  s /= n;
  int t = n;
  double d = 10000;
  for (int i = n - 1; i >= 0; i--) {
    if (abs(a[i] - s) <= d) {
      t = i;
    }
  }
  cout << t << endl;
  return 0;
}
