#include <bits/stdc++.h>
using namespace std;

int main() {
	double n, ave = 0;
	double a[1000];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		ave += a[i] * 1.0;
	}
	ave /= n;
	double min = 100000, ans = 0;
	for (int i = 0; i < n; i++) {
		if (abs(a[i] - ave) < min) {
			ans = i;
			min = abs(a[i] - ave);
		}
	}
	cout << ans << endl;
}