#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long N;
  cin >> N;
  double heikin = 0;
  vector<long long> A(N);
  for (long long i = 0; i < N; i++) {
    cin >> A.at(i);
    heikin += A.at(i);
  }
  heikin = heikin / (double)N;
  long long sa = 1000;
  long long ans;
  for (long long i = N - 1; i >= 0; i--) {
    if (abs(heikin - A.at(i)) < sa) {
      ans = i;
      sa = abs(heikin - A.at(i));
    }
  }
  cout << ans << endl;
}
