#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>

using namespace std;

int main(void){
	int n;
	cin >> n;
	vector<auto> v(n);
	int sum = 0;
	for(int i=0;i<n;i++){
		cin >> v[i];
		sum += v[i];
	}
	auto ave = sum / n;
	for(int i=0;i<n;i++){
		v[i] -= (auto)ave;
	}
	auto iter = min_element(v.begin(), v.end());
	cout << distance(v.begin(), iter) << endl;
	return 0;
}