#include <iostream>
#include <cmath>
using namespace std;

int N, a[10009], sum, minx = 100000000, minid = 0;

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) { cin >> a[i]; sum += a[i]; }
	for (int i = 0; i < N; i++) {
		int J = abs(a[i] * N - sum);
		if (minx > J) {
			minx = J; minid = i;
		}
	}
	cout << minid << endl;
	return 0;
}
