#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  double ave = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    ave += a[i];
  }
  ave /= N;
  double minv = 1e9;
  int ans = -1;
  for (int i = 0; i < N; i++) {
    if (minv > abs(a[i] - ave)) {
      minv = abs(a[i] - ave);
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}
