#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, i, j;
  j = 0;
  double b, c;
  c = 100000;
  b = 0.0;
  cin >> N;
  int a[N];
  int D[N];
  for (i = 0; i < N; i++) {
    cin >> a[i];
    b = b + a[i];
  }
  b = b / N;
  for (i = 0; i < N; i++) {
    D[i] = abs(b - a[i]);
  }
  for (i = 0; i < N; i++) {
    if (c > D[i]) {
      c = D[i];
      j = i;
    }
  }
  cout << j << endl;
}
