#include<bits/stdc++.h>
using namespace std;
int main(){
  long N,a[100000];
  cin>>N;
  long total=0;
  for(int i=0;i<N;i++){
    cin>>a[i];
    total+=a[i];
  }
  double avg=(double)total/N;
  double min=100;
  int ans;
  for(int i=N-1;i>=0;i--){
  	if(abs(a[i]-avg)<=min){
    	ans=i;
      	min=abs(a[i]-avg);
    }
  }
  cout<<ans<<endl;
}