#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  double sum = 0;
  double a[n + 1];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  double x = sum / n;
  int k = n - 1;
  double m = abs(a[n - 1] - x);
  for (int i = n - 2; i >= 0; i--) {
    if (m >= abs(a[i] - x)) {
      k = i;
    }
  }
  cout << k << endl;
}
