#include <bits/stdc++.h>

using namespace std;

int main(){
  int n;
  cin >> n;

  int sum;
  vector<int> a(n);

  for(int i = 0;i < n;i++){
    cin >> a[i];
    sum += a[i];
  }

  int ret = 0;
  int min = 10000;

  for(int i = 0;i < n;i++){
    double dif = abs((double)a[i] - (double)sum/n) ;
    if(dif < min){
      min = dif;
      ret = i;
    }
  }

  cout << ret << endl;