#include <bits/stdc++.h>

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> a;
	int sum = 0;
	while (n--) {
		int x;
		cin >> x;
		a.push_back(x);
		sum += x;
	}
	double avg = 1.0 * sum / a.size();
	int idx = 0;
	for (int i = 1; i < a.size(); i++) {
		if (fabs(a[i] - avg) < fabs(a[idx] - avg)) {
			idx = i;
		}
	}
	cout << idx << endl;
}