#include<bits/stdc++.h>
using namespace std;
int main(){
   int n,s=0;
   cin>>n;
   int a[n];
   for(int i=0;i<n;i++) {cin>>a[i]; s+=a[i];}
   double avg=double(s)/n;
   int ans=0;
   double val=abs(avg-a[0]);
   for(int i=1;i<n;i++){
       if(abs(avg-a[i])<val) {ans=i; val=abs(avg-a[i]);}
   }
   cout<<ans;
}