#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<int> a(N);
	for (auto &x : a) {
		cin >> x;
	}
	auto s = accumulate(a.begin(), a.end(), 0);
	
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		if (abs(a[i] * N - s) < abs(a[ans] * N - s)) {
			ans = i;
		}
	}
	cout << ans << endl;
}
