#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  int ave = accumulate(a.begin(), a.end(), 0) / a.size();
  int minv = 100000000;
  int minidx = N;
  for (int i = 0; i < N; i++) {
    if (minv > abs(a[i] - ave)) {
      minv = abs(a[i] - ave);
      minidx = min(minidx, i);
    }
  }
  cout << minidx << endl;
  return 0;
}
