#import <Foundation/Foundation.h>
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)

int main() {
	int n;
	scanf("%d", &n);
	int a[100];
	int sum = 0;
	rep(i, n) {
		scanf("%d", a + i);
		sum += a[i];
	}
	int min = 100000;
	int ans = -1;
	rep(i, n) {
		int diff = ABS(n * a[i] - sum);
		if (diff < min) {
			ans = i;
			min = diff;
		}
	}
	printf("%d\n", ans);
}
