#include <bits/stdc++.h>
using namespace std;

int main(){
  int N;
  cin >> N;
  int a[N];
  int ans=0;
  int sum=0;
  for (int i=0;i<N;i++){
    cin >> a[i];
    sum+=a[i];
  }
  for (int i=0;i<N;i++){
    ans=abs(sum-N*a[i])<abs(sum-N*a[ans])?i:ans;
  }  
  cout << ans << endl;
}
