#include "bits/stdc++.h"
using namespace std;
const int maxn = 1024;
int main(){
	int n, k;
	cin >> n;
	vector<long long> a(n);
	long long s = 0;
	for(auto & v : a) cin >> v, s += v;
	long long diff = 1ll<<60;
	for(auto & v : a) diff = min(diff, abs(v * n - s));
	for(int e = 0; e < n; e++){
		if(diff == abs(a[e] * n - s)){
			cout << e  << endl;
			return 0;
		}
	}
	return 0;
}
