#include<iostream>
#include<cmath>
using namespace std;
int main(){
int n;
  cin>>n;
  int a[n];
  int sum = 0;
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
    sum+=a[i];
  }
  double mn = (double)(sum)/(double)(n);
  double mx = 101010.022;
  int ans = 0;
  for(int i=0;i<n;i++)
  {
    if( abs(mn-a[i]) < mx)
    {
      mx = abs(mn-a[i]);
      ans = i;
    }
  }
cout<<ans;
}

