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