#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  double av = 0;
  for (long long i = (long long)(0); i < (long long)(N); i++) {
    cin >> A[i];
    av += A[i];
  }
  av = av * 1.0 / N;
  double memo = 1000000007;
  long long ans;
  for (long long i = (long long)(0); i < (long long)(N); i++) {
    if (memo > abs(memo - (double)A[i])) {
      memo = abs(memo - (double)A[i]);
      ans = i;
    }
  }
  cout << ans << endl;
}
