#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  std::vector<int> a(N), v(N);
  for (int i = 0; i < N; i++) cin >> a[i];
  for (int i = 0; i < N; i++) v[i] = a[i];
  double k = 0;
  for (int i = 0; i < N; i++) k += a[i];
  k /= N;
  sort(v.begin(), v.end());
  int r;
  int m = 1e9 + 7;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (abs(a[i] - k) < m) {
      ans = i;
      m = abs(a[i] - k);
    }
  }
  cout << ans << endl;
}
