#include <bits/stdc++.h>
int main() {
  int n;
  while (1 == scanf("%d", &n)) {
    int a[n], i, sum = 0, ave, min, ok;
    for (i = 0; i < n; i++) scanf("%d", &a[i]);
    for (i = 0; i < n; i++) sum += a[i];
    ave = sum / 1.0 / n;
    min = abs(a[0] - ave);
    ok = 0;
    for (i = 1; i < n; i++)
      if (abs(a[i] - ave) < min) {
        ok = i;
        min = abs(a[i] - ave);
      }
    printf("%d", ok);
  }
  return 0;
}
