#include <bits/stdc++.h>
int main(void) {
  int n, i, a[1000], sum = 0, k = 0, j;
  double total;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    sum = sum + a[i];
  }
  total = sum / i;
  j = total - (double)a[0];
  for (i = 0; i < n; i++) {
    if (fabs(total - (double)a[i]) < fabs(j)) {
      k = i;
      j = total - (double)a[i];
    }
  }
  printf("%d\n", k);
  return 0;
}
