#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n;
  int ave;
  int absmin = 0x3FFF, index_min;
  cin >> n;
  std::vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a.at(i);
  ave = std::accumulate(a.begin(), a.end(), 0) / n;
  for (int i = 0; i < n; ++i) {
    if (abs(a.at(i) - ave) < absmin) {
      absmin = abs(a.at(i) - ave);
      index_min = i;
    }
  }
  cout << (index_min) << endl;
  return 0;
}
