#include <bits/stdc++.h>
int d(int x, int y) { return (x < y) ? (y - x) : (x - y); }
int main() {
  int n, a[100], sum = 0, m[2], dif = 1e5, ans;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    sum += a[i];
  }
  if ((sum * 2) % n == 0 && (sum * 2 / n) % 2 == 1) {
    m[0] = sum / n;
    m[1] = m[0] + 1;
  } else {
    m[0] = (sum + n / 2) / n;
    m[1] = -1e7;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2; j++) {
      if (d(a[i], m[j]) < dif) {
        ans = i;
        dif = d(a[i], m[j]);
      }
    }
  }
  printf("%d", ans);
  return 0;
}
