#include<bits/stdc++.h>
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];}
    
  for(int i=0; i<n; i++){a[i] = abs(n * a[i]-sum);}
  
  int min = 100 * n;
  int ans = 0;
  for(int i=0; i<n; i++){
    if (min > a[i]){
      min = a[i];
      ans = i;
    }
  }
  
  cout << ans << endl;
}