#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <cstdlib>
#include <cmath>
int main() {
  int N,i,j;
j=0;
double b,c;
c=100000;
b=0.0;
cin>>N;
int a[N];
double D[N];
for(i=0;i<N;i++){
cin>>a[i];
b=b+a[i];
}
b=b/N;
for(i=0;i<N;i++){
D[i]=abs(b-a[i]);
}
for(i=0;i<N;i++){
if(c>D[i]){
c=D[i];
j=i;
}
}
cout<<j<<endl;
}