#include <bits/stdc++.h>
double ABS(double n) { return n < 0 ? (-1) * n : n; }
void sort(double *a, int size) {
  for (int i = 0; i < size; i++) {
    for (int j = i; j < size - 1; j++) {
      if (a[j] > a[j + 1]) {
        double tmp = a[j];
        a[j] = a[j + 1];
        a[j + 1] = tmp;
      }
    }
  }
}
int main(void) {
  int N;
  scanf("%d", &N);
  int a[N];
  double b[N];
  double sum = 0;
  for (int i = 0; i < N; i++) {
    scanf("%d", &a[i]);
    b[i] = a[i];
    sum += b[i];
  }
  double mean = sum / N;
  for (int i = 0; i < N; i++) {
    b[i] = ABS(b[i] - mean);
  }
  sort(b, N);
  int i = 0;
  int ans = 0;
  while (i < N) {
    if (ABS(a[i] - mean) == b[0]) {
      ans = i;
      break;
    }
    i++;
  }
  printf("%d\n", ans);
  return 0;
}
