#include <bits/stdc++.h>
int main(void) {
  int N;
  int a[200001];
  int ans;
  int sum = 0;
  int check = 999999999;
  double ave;
  scanf("%d", &N);
  for (int b = 0; b < N; b++) {
    scanf("%d", &a[b]);
    sum += a[b];
  }
  ave = sum / N;
  for (int c = 0; c < N; c++) {
    if ((ave - a[c]) * (ave - a[c]) < (ave - check) * (ave - check)) {
      check = a[c];
      ans = c;
    }
  }
  printf("%d", ans);
  return 0;
}
