#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

int main() {
  int N, ans = 1000, index;
  double = sum = 0;
  int a[100];
  cin >> N;
  for(int i=0;i<N;++i) {
    cin >> a[i];
    sum += a[i];
  }

  sum/=N;

  for(int i=0; i<N; ++i) {
    if(abs(ans-sum)>abs(a[i]-sum)) {
      ans = a[i];
      index = i;
    }
  }

  cout << index << endl;

  return 0;
}
