#include "bits/stdc++.h"
using namespace std;
int main(){
  int n,a,i,sum=0,diff=10001,ans=0;
  cin >> n;
  vector<int> m(n);
  for(i=0;i<n;i++){
    cin >> a;
    sum += a;
    m.at(i) = a*n;
  }
  for(i=0;i<n;i++){
    if(abs(m.at(i)-sum)<diff){
      diff = abs(m.at(i)-sum);
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}