#include <stdio.h>

int main(void) {
	int n;
	int a[4096];
	int i,ttl, avg, idx, diff;
	
	scanf("%d", &n);
	
	ttl = 0;
	for (i = 0; i < n; i++) {
		scanf("%d", &a[i];)
		ttl += [i];
	}
	
	avg = ttl / n;
	
	idx = 0;
	diff = a[0];
	for (i = 0; i < n; i++) {
		if (diff > abs(avg - a[i])) {
			diff = abs(avg - a[i]);
			idx = i;
		}
	}
	
	printf("%d", idx);


}