#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<double> as(n);
  for (auto &a : as) {
    cin >> a;
  }
  double sum = accumulate(as.begin(), as.end()), ave = sum / n;
  int ans = -1;
  double diff = 1e9 + 7;
  for (int i = 0; i < n; i++) {
    if (abs(as[i] - ave) < diff) {
      diff = abs(as[i] - ave);
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}