#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  cin >> N;
  vector<double> a(N);
  for (int i = 0; i < N; i++) cin >> a[i];
  double avg = accumulate((a).begin(), (a).end(), 0) / N;
  double diff = 1 << 30;
  int ans = 0;
  for (int i = 0; i < N; ++i) {
    if (diff > abs(a[i] - avg)) {
      diff = abs(a[i] - avg);
      ans = i;
    }
  }
  cout << ans << endl;
}
