#include <bits/stdc++.h>
int main(void) {
  int n, *a, n1 = 0, n2 = 0, k = 0;
  scanf("%d", &n);
  a = (int *)malloc(sizeof(int) * n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < n; ++i) {
    n1 += a[i];
  }
  n1 /= n;
  n2 = abs(a[0] - n1);
  for (int i = 1; i < n; ++i) {
    if (n2 > abs(a[i] - n1)) {
      n2 = abs(a[i] - n1);
      k = i;
    }
  }
  printf("%d\n", k);
  return 0;
}
