#include <iostream>
#include <algorithm>
using namespace std;

int main() {
	int N, count = 0;
	double A[100], B[100], flame, out;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		count += A[i];
	}
	flame = count / N;
	for (int i = 0; i < N; i++) {
		B[i] = fabs(flame - A[i]);
	}
	sort(B, B + N);
	for (int i = 0; i < N; i++) {
		if (A[i] == flame + B[0] || A[i] == flame - B[0]) {
			out = i;
			break;
		}
	}
	cout << out << endl;
}