#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  double ave = 0;
  vector<double> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    ave += A[i];
  }
  ave /= (double)N;
  double dis = 1000.000;
  int ans;
  for (int i = 0; i < N; i++) {
    int d = ave - A[i];
    if (d < 0) d *= -1;
    if (dis > d) {
      dis = d;
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}
