#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int64_t N;
  cin >> N;
  vector<int64_t> a(N);
  double ave = 0;
  for (int64_t i = 0; i < N; i++) {
    cin >> a[i];
    ave += a[i];
  }
  ave /= N;
  int64_t dif = 1e10;
  int64_t ans;
  for (int64_t i = 0; i < N; i++) {
    if (abs(a[i] - ave) < dif) ans = i;
    dif = abs(a[i] - ave);
  }
  cout << ans << endl;
}
