#include<iostream>
#include <cmath>
using namespace std;
int N;
int a[110],sum,ave,min;

int main()
{
	cin >> N;
	sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		sum += a[i];
	}
	//ave = sum / N;
	min = 1000 * N;
	for (int i = 0; i < N; i++) {
		if (min > abs(sum - a[i] * N)) {
			min = abs(sum - a[i] * N);
		}
	}
	
	for (int i = 0; i < N; i++) {
		if (min == abs(sum - a[i] * N)) {
			cout << i << endl;
			//system("pause");
			return 0;
		}
	}

    return 0;
}