#include <bits/stdc++.h>
using namespace std;

int main(void){
	int n;
	double ave = 0;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; ++i){
		cin >> a[i];
		ave += a[i];
	}
	ave /= n;
	double a_m = 10000.0;
	int i_m;
	for(int i = n-1; i >= 0; i--){
		a_m = min(a_m, abs(a[i] - ave));
		if(a_m == abs(a[i] - ave)){
			i_m = i;
		}
	}
	cout << i_m << endl;
	return 0;
}