#include <bits/stdc++.h>
int abs(int a) { return a > 0 ? a : -a; }
int main(void) {
  int i, n, ans = 1e9, ansn, now = 0;
  scanf("%d", &n);
  int a[n];
  for (i = 0; i < n; ++i) scanf("%d", &a[i]), now += a[i];
  for (i = n - 1; i >= 0; --i)
    if (ans > abs(now - a[i] * n)) ans = abs(now - a[i] * n), ansn = i;
  printf("%d", ansn);
  return 0;
}
