shared void main(){
  assert(exists t=process.readLine());
  assert(exists n=parseInteger(t));
  assert(exists tt=process.readLine());
  value a=tt.split();
  variable Float sm=0.0;
  for(i in a){
    assert(exists aa=parseFloat(i));
    sm += aa;
  }
  variable Float ave = sm/n;
  
  variable Float mn=100.0;
  variable Integer mni=0;
  variable Integer idx=0;
  for(i in a){
    assert(exists aa=parseFloat(i));
    variable Float tmp;
    if(aa-ave>=0.0){tmp=aa-ave;}
    else{tmp=ave-aa;}
    
    if(mn>tmp){
      mn = tmp;
      mni = idx;
    }
    idx += 1;
  }
  print(mni);
}