#include <cmath>
#include <vector>
#include <iostream>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	int avg = 0;
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
		avg += A[i];
		A[i] *= N;
	}
	int mn = 1 << 30, ptr = -1;
	for (int i = 0; i < N; ++i) {
		int c = abs(A[i] - avg);
		if (mn > c) {
			mn = c;
			ptr = i;
		}
	}
	cout << ptr << endl;
	return 0;
}