#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[100000], sum(0);
  cin >> n;
  for (int i(0); i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  double ave = (double)sum / n;
  double min = abs(a[0] - ave);
  int out(0);
  for (int i(n - 1); i >= 0; i--) {
    if (min >= abs(a[i] - ave)) {
      min = abs(a[i] - ave);
      out = i;
    }
  }
  cout << out;
}
