#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  double mean = 0;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    int temp;
    cin >> temp;
    a[i] = temp;
    mean += temp;
  }
  mean /= N;
  int min = 100000;
  int out = 0;
  for (int i = 0; i < N; i++) {
    if (abs(mean - a[i]) < min) {
      min = abs(mean - (double)a[i]);
      out = i;
    }
  }
  cout << out << endl;
}
