#include "bits/stdc++.h"
using namespace std;
#define int long long
int mod=1e9+7;

signed main(){
  int n;
  cin>>n;
  vector<double> a(n);
  double sum=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    sum+=a[i];
  }
  double ans=sum/n;
  double sa=1e9;
  int id=0;
  for(int i=0;i<n;i++){
    if(sa>abs(ans-a[i])){
      sa=abs(ans-a[i]);
      id=i;
    }
  }
  cout<<id<<endl;
}
