#include <iostream>
using namespace std;

double abs(double x) {
    if (x > 0.0) {
        return x;
    } else {
        return x * (-1);
    }
}

int main(){

    int N;
    cin >> N;

    int a[110];
    int sum = 0;
    for (int i=0; i<N; i++) {
        cin >> a[i];
        sum += a[i];
    }
    double mean;
    mean = sum * 1.0/N;

    int itr = -1;
    int diff = 10000;
    for (int i=0; i<N; i++) {
        if (abs(a[i]-mean) < diff) {
            itr = i;
            diff = abs(a[i]-mean);
        }
    }

    cout << itr << endl;

    return 0;
}
