#include <bits/stdc++.h>
using namespace std;
int a[1000];
int main() {
  int n;
  int sum = 0;
  double ss;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    sum += a[i];
  }
  ss = sum * 1.0 / n;
  int j;
  double mins = sum;
  for (int i = 0; i < n; i++) {
    int sss = (ss - a[i]);
    if (sss < 0) sss = -sss;
    if (sss < mins) {
      j = i;
      mins = sss;
    }
  }
  printf("%d\n", j);
  return 0;
}
