#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < (N); ++i) cin >> a[i];
  double s = 0;
  for (int i = 0; i < (N); ++i) {
    s += a[i];
  }
  s /= N;
  float min = 10000;
  int min_num = 10000;
  for (int i = N - 1; i >= 0; i--) {
    if (abs(s - a[i]) <= min) {
      min = abs(s - a[i]);
      min_num = i;
    }
  }
  cout << min_num << endl;
  return 0;
}
