#include<stdio.h>
#include<stdlib.h>

int main() {
  double n, a[2525], num, ans, plas, ave, i, min, sa;

  scanf("%lf", &n);

  for(num = 0;num < n;num++) {
    scanf("%lf", &a[num]);
    plas = plas + a[num];
  }

  ave = plas / num;

  for(num = n - 1;num < 0;num--) {
    sa = a[num] - ave;
    if(sa <= min) {
      min = sa;
      i = num;
    }
  }

  printf("%d", (int)i);

  return 0;

}
