#include<iostream>
#include<cmath>
using namespace std;
int main(void){
	
	int n,i,minnum=10000,mina;
	double ave=0;
	cin>>n;
	int a[n];
	for(i=0;i<n;i++){
		cin>>a[i];
		ave+=a[i];
	}
	for(i=0;i<n;i++){
//		cout<<minnum<<" "<<abs(ave-a[i]*n)<<" "<<a[i]<<endl;
		if(minnum>abs(ave-a[i]*n)){
			mina=i;
			minnum=abs(ave-a[i]*n);
		}
	}
	cout<<mina<<endl;
	return 0;
}