#include <stdio.h>
#include <math.h>

int main(void)
{
	int i,n,ans;
	int a[102];
	double ab[102];
	long int sum = 0;
	double small;
	double ave;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++){
		scanf("%d ", &a[i]);
		sum += a[i];
	}
	
	ave = sum/n;
	
	for (i = 0; i < n; i++){
		ab[i] = fabs(ave - a[i]);
	}
	
	small = ab[0];
	ans = 0;
	
	for (i = 0; i < n; i++){
		if(ab[i] < small){
			small = ab[i];
			ans = i;
	}
	
	printf("%d", ans);
	
	return 0;
}