#include <iostream>
#include <vector>
using namespace std;

int main(){
  int id = 0, N, s = 0;
  cin >> N;
  vector<int> A(N);
  for(int i = 0; i < N; ++i) cin >> A[i], s += A[i];
  for(int i = 0; i < N; ++i){
    if(abs(A[i]*N - s) < abs(A[id]*N - s)) id = i;
  }
  cout << id << endl;
  return 0;
}
