#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  cin >> N;
  int a[N];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  float ave;
  int sum = 0;
  for (int i = 0; i < N; i++) {
    sum += a[i];
  }
  ave = sum / N;
  float b[N];
  for (int i = 0; i < N; i++) {
    b[i] = abs(a[i] - ave);
  }
  int A = 0;
  int diff = b[0];
  for (int i = 1; i < N; i++) {
    if (b[i] < diff) {
      diff = b[i];
      A = i;
    }
  }
https:
  cout << A << endl;
}
