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

int main() {
	int n;
	cin>>n;
	double a[n],average=0;
	for(int i=0;i<n;i++) {
		cin>>a[i];
		average+=a[i];
	}
	average/=(double)n;
	
	int ans;
	double minus=10000;
	for(int i=0;i<n;i++)
		if(abs(average-a[i])<minus) {
			minus=abs(average-a[i]);
			ans=i;
		}
	
	cout<<ans<<endl;
	return 0;
}