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

#define rep(i, n) for(int i = 0; i < n; i++)

const int mod = 1000000007;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	int sum = 0;
	rep(i, n) {
		cin >> a[i];
		sum += a[i];
	}
	double ave = (double)sum / n;

	rep(i, n) {
		a[i] = fabs(ave - a[i]);
	}

	int mi = (int)1e9;
	int num = (int)1e9;

	rep(i, n) {
		if (mi >= a[i]) {
			if (mi == a[i]) {
				if (num > i) num = i;
			}
			else {
				num = i;
			}
			mi = a[i];
		}
	}

	cout << num << endl;
	return 0;
}