#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];
  }
  double ave = accumulate(a.begin(), a.end(), 0) / a.size();
  double temp = 1111111111111;
  int ans = a.size() - 1;
  for (int i = N - 1; 0 <= i; i--) {
    if (abs(ave - a[i]) <= temp) {
      temp = abs(ave - a[i]);
      ans = i;
    }
  }
  cout << ans << endl;
}
