#include "bits/stdc++.h"
using namespace std;
int main()
{
	int n, ind = 0;
	double ave = 0, diff = 1000000000;
	scanf("%d", &n);
	vector<double> a(n);
	for(int i = 0; i < n; ++i)
	{
		scanf("%lf", &a[i]);
		ave += a[i];
	}
	ave /= n;
	for(int i = 0; i < n; ++i)
	{
		if(diff > abs(ave - a[i]))
		{
			ind = i;
			diff = abs(ave - a[i]);
		}
	}
	printf("%d\n", ind);
}