#include <bits/stdc++.h>
int main(void) {
  int n;
  int a[4096];
  int i, ttl, avg, idx, diff;
  scanf("%d", &n);
  ttl = 0;
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    ttl += a[i];
  }
  avg = ttl / n;
  idx = 0;
  diff = a[0];
  for (i = 0; i < n; i++) {
    if (diff > fabs(avg - a[i])) {
      diff = fabs(avg - a[i]);
      idx = i;
    }
  }
  printf("%d", idx);
}
