#include <bits/stdc++.h>
int main(void) {
  int N;
  int sum = 0;
  if (scanf("%d", &N) < 1 || N > 100) exit(1);
  int a[N];
  for (int i = 0; i < N; i++) {
    if (scanf("%d", &a[i]) < 1 || N > 100) exit(1);
    sum += a[i];
  }
  int ave = sum / N;
  int ave_move = ave;
  int flag = 1;
  int small, small_N, big, big_N;
  do {
    for (int i = 0; i < N; i++) {
      if (ave_move == a[i]) {
        flag = 1;
        small = a[i];
        small_N = i;
        break;
      } else {
        flag = 0;
      }
    }
    ave_move--;
    if (ave_move < 1) break;
  } while (flag == 0);
  ave_move = ave + 1;
  flag = 0;
  do {
    for (int i = 0; i < N; i++) {
      if (ave_move == a[i]) {
        flag = 1;
        big = a[i];
        big_N = i;
        break;
      } else {
        flag = 0;
      }
    }
    ave_move++;
    if (ave_move > 100) break;
  } while (flag == 0);
  if (big < small) {
    printf("%d\n", big_N);
  } else {
    if (big > small) printf("%d\n", small_N);
    if (big == small) printf("%d\n", small_N);
  }
  return 0;
}
