#include<iostream>
#include<cmath>

using namespace std;

int main(){
    int N;
    cin >> N;
    int a[N];
    double avg = 0;

    for(int i=0; i<N; i++){
        cin >> a[i];
        avg += a[i];
    }
    avg /= N;


    int min = 0;
    for(int i=0; i<N; i++){
        if(abs(avg - a[i]) < abs(avg - a[min]))
            min = i;
    }

    cout << min << endl;

    return 0;
}
