#include <bits/stdc++.h>
using namespace std;
void solve() {
  long N;
  cin >> N;
  vector<long> a(N);
  for (long i = 0; i < N; i++) cin >> a[i];
  double avg;
  for (long i = 0; i < N; i++) avg += a[i];
  avg /= N;
  double foo = abs(avg - a[0]);
  long bar = 0;
  for (long i = 0; i < N; i++) {
    double tmp = abs(avg - a[i]);
    if (tmp < foo) {
      foo = tmp;
      bar = i;
    }
  }
  cout << bar << endl;
}
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}
