#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <math.h>
#define rep(i,s,n) for(int i = s; n > i; i++)
#define REP(i,n) rep(i,0,n)
#define ll long long int
#define ALL(a) a.begin(), a.end()
using namespace std;

template<class T>
class segtree {
	vector<T> tree;
public:
	segtree(const int n) :tree(n * 2) {}
	int base() const { return tree.size() / 2; }
	void update(int i, const T&v) {
		i += base();
		tree[i] = v;
		while (i /= 2)
			tree[i] = tree[i * 2] + tree[i * 2 + 1];
	}
	T fold(int f, int l)const {
		f += base();
		l += base();
		T accl, accr;
		while (f < l) {
			if (f & 1)
				accl = accl + tree[f++];
			f /= 2;
			if (l & 1)
				accr = tree[--l] + accr;
			l /= 2;
		}
		return accl + accr;
	}
};


ll k;

struct hoge {
	bool flip;
	ll sum;
	hoge(bool x = 0, ll y = 0) :flip(x), sum(y) {}
	hoge operator+(const hoge &r)const {
		if (flip)
			return hoge(!r.flip, (sum - r.sum + k) % k);
		else
			return hoge(r.flip, (sum + r.sum) % k);
	}
};

ll getmod(const ll a) {
	return (a%k + k) % k;
}

hoge make(const ll a) {
	if (a != 0)
		return hoge(0, a);
	else
		return hoge(1, 0);
}


int gcd(int a, int b) {
	if(a < b) swap(a, b);
	while (b != 0)
		a %= b, swap(a, b);
	return a;
}

typedef pair<int, int> pii;
int main() {
	int n;
	cin >> n;

	vector<int> a(n);
	double sum = 0;
	REP(i, n) cin >> a[i], sum += a[i];

	sum /= n;
	pair<float, int> Min = {999999, 0};
	REP(i, n) Min = min(Min,MP(fabs(sum - a[i]), i ));

	cout << Min.second << endl;

	return 0;
}
