#include <bits/stdc++.h>
using namespace std;
double zettai(double a) {
  if (a < 0) {
    return -a;
  } else {
    return a;
  }
}
int main() {
  int N;
  bool half = true;
  cin >> N;
  vector<int> a(N);
  int k = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    k += a[i];
  }
  double ave = static_cast<double>(k) / N;
  vector<double> b(N);
  vector<double> c(N);
  for (int i = 0; i < N; i++) {
    b[i] = c[i] = zettai(a[i] - ave);
  }
  sort(b.begin(), b.end());
  bool ans = false;
  for (int i = 0; i < N; i++) {
    if (c[i] == b[0]) {
      cout << i << endl;
      ans = true;
    }
    if (ans) break;
  }
}
