#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;++i)

signed main(){
    int n;
    cin>>n;
    vector<double>a(n);
    rep(i,0,n)cin>>a[i];
    double ave=accumulate(a.begin(),a.end(),double(0))/n; //合計 accumulate(始め,終わり,初期値)
    rep(i,0,n)a[i]=abs(a[i]-ave);
  	cout<<min_element(a.begin(),a.end())-a.begin();
}