#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  int sum=0;
  for(int i=0;i<n;i++){
    cin >> a[i];
    sum+=a[i];
    a[i]*=n;
  }
  int t=1000000,ans=0;
  for(int i=0;i<n;i++){
    if(t>abs(sum-a[i])){
      t=abs(sum-a[i]);
      ans=i;
    }
  }
  cout << ans << endl;
}