#include <stdio.h>
int main(void){

    int N, a[100], MIN, i, u, v[100];
    double sum = 0, ave, min = 100;
    
	u = scanf("%d", &N);
    
    for(i = 0 ; i < N ; i++){
       v = scanf("%d", &a[i]);
        sum += a[i];
    }
    
    ave = sum / (double)N;
    
    for(i = N-1; i >= 0; i--){

    if(a[i] >= ave){
        if(min >= a[i] - ave){
            min = a[i] - ave;
            MIN = i;
        }
    }else{
        if(min > ave - a[i]){
            min = ave - a[i];
            MIN = i;
        }
    }
    }
    
    printf("%d", MIN);
    
    return 0;
}
