#include<bits/stdc++.h>
using namespace std;

int a[10001];

int main(){
	double num = 0,minn;
	int mini,n,m,i,j,k,t,s;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		num += a[i];
	}
	num = num / (int)n;
	mini = 0;minn = abs(a[0]-num);
	for(i=1;i<n;i++){
		double nn = abs((double)a[i]-num);
		if(nn<minn){
			minn = nn;
			mini = i;
		}
	}
	printf("%d",mini);
	return 0;
}