#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::vector;
int main(int argc, char* argv[]) {
  std::ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<int> a(N);
  double avg = 0;
  for (auto& ai : a) {
    cin >> ai;
    avg += ai;
  }
  avg /= N;
  int res = 0;
  for (int t = 0; t < N; ++t) {
    if (abs(a[t] - avg) < abs(a[res] - avg)) res = t;
  }
  cout << res << "\n";
  return 0;
}
