#include <bits/stdc++.h>

int main() {
	int n;
	std::cin >> n;
	std::vector<int> a(n);
	for(int i = 0; i < n; ++i) 
		std::cin >> a[i];

	int sum = 0;
	for(auto v : a) 
		sum += v;
	int mi = 1e9;
	for(auto v : a)
		mi = std::min(std::abs(v * n - sum), mi);
	for(int i = 0; i < (int)a.size(); ++i)
		if(std::abs(a[i] * n - sum) == mi) {
			std::cout << i << '\n';
			return 0;
		}
}
