#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,pos;
    cin>>n;
    int a[n],i;
    double avg,sum=0,temp=100000000;
    for(i=0;i<n;i++) {cin>>a[i];sum+=a[i];}
    avg=sum/n;
    for(i=0;i<n;i++)
    {
        if(abs(avg-a[i])<temp) {temp =abs(avg-a[i]);pos=i;}
    }
    cout<<pos<<endl;
    return 0;
}
