#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	double average;
	cin>>n;
	int f[n];
	for(int i=0;i<n;i++)
	{
		cin>>f[i];
		average+=f[i];
	}
	average/=n;
	double ans,minn=999999999;
	for(int i=0;i<n;i++)
	if(abs((double)f[i]-average)<minn)
	{
		minn=abs(f[i]-average);
		ans=i;
	}
	cout<<ans;
}