#include <bits/stdc++.h>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	int sum = 0;
	for (auto& x : A) {
		cin >> x;
		sum += x;
	}
	vector<pair<int,int>> a;
	for (int i = 0; i < N; ++ i) {
		a.push_back({abs(N*A[i] - sum), i});
	}
	sort(a.begin(), a.end());
	cout << a[0].second << endl;
}
