#include <bits/stdc++.h>
using namespace std;
int a[1919];
int main() {
  double n;
  double iwa = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    iwa += a[i];
  }
  iwa = iwa / (n * 1.00);
  for (int i = 0; i < n; i++) {
    a[i] = abs(iwa - a[i]);
  }
  double ta = 10000;
  int se = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (a[i] <= ta) {
      ta = a[i];
      se = i;
    }
  }
  cout << se << endl;
}
