#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  int answer;
  int i;
  float min = 0;
  cin >> N;
  float sum = 0;
  int vec[500];
  float vec2[500];
  for (i = 0; i < N; i++) {
    cin >> vec[i];
    sum = sum + vec[i];
  }
  sum = sum / N;
  for (i = 0; i < N; i++) {
    vec2[i] = abs(vec[i] - sum);
  }
  for (i = 0; i < N; i++) {
    if (min < vec2[i]) {
      min = vec2[i];
    }
  }
  for (i = 0; i < N; i++) {
    if (min == vec2[i]) {
      answer = i;
      min = min - 1;
    }
  }
  cout << answer;
}
