#include <iostream>
#include <cmath>
#include <cstdlib>

using namespace std;

int main() {
	int n;
	int a[150];
	double ave;
	double sum = 0;
	int tmp = 0;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}

	ave = sum / n;

	for (int i = 0; i < n; i++) {
		if (fabs(ave - a[i]) < fabs(ave - a[tmp]))
			tmp = i;
	}

	cout << tmp << endl;
	return 0;
}