#include <bits/stdc++.h>

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
#define P pair<int, int>
struct data{
	int place;
	int cost;

	bool operator<(const data &ri) const{
		return cost < ri.cost;
	}
	bool operator>(const data &ri) const{
		return cost > ri.cost;
	}
};
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};



int main(){
	int n;
	int a[100];
	double ave = 0.0;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		ave += a[i];
	}
	ave /= 1.0 * n;
	int index = -1;
	double dis = inf*1.0;
	for(int i = 0; i < n; i++){
		if(abs(ave - a[i]) < dis){
			dis = abs(ave - a[i]);
			index = i;
		}
	}

	cout << index << endl;

	return 0;
}