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

int main(){
  int n;
  cin>>n;
  vector<int> v(n);
  int sum=0;
  rep(i,n) {
    cin >> v[i];
    sum+=v[i];
  }
  double x = (double)sum /n;
  int ans = 10000, res;
  rep(i,n){
    if(ans > abs(x-v[i]){
      ans = abs(x-v[i]);
      res = i;
    }
  }
  cout<<res<<endl;
}