#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int ave = 0;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    ave += A[i];
  }
  ave /= N;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (abs(A[ans] - ave) > abs(A[i] - ave)) {
      ans = i;
    }
  }
  cout << ans << endl;
}
