#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, ans, c = 100000;
  double avg;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
  }
  avg = accumulate(a.begin(), a.end(), 0) / a.size();
  for (int i = 0; i < N; i++) {
    if (avg > a.at(i)) {
      if (c > avg - a.at(i)) {
        ans = i;
        c = avg - a.at(i);
      }
    } else {
      if (c > a.at(i) - avg) {
        ans = i;
        c = a.at(i) - avg;
      }
    }
  }
  cout << ans;
}
