#include <bits/stdc++.h>
int main() {
  int a[1000];
  int n, x, h, m;
  double sum, avg;
  while (scanf("%d\n", &n) != EOF) {
    h = 99999;
    sum = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
      sum += a[i];
    }
    avg = sum * 1.0 / n;
    for (int i = 0; i < n; i++) {
      m = fabs(a[i] - avg);
      if (m < h) {
        h = m;
        x = i;
      }
    }
    printf("%d\n", x);
  }
  return 0;
}
