#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
signed main() {
  long long N;
  cin >> N;
  long long a[N];
  long long total = 0;
  for (long long i = 0; i < N; i++) {
    cin >> a[i];
    total += a[i];
  }
  double heikin = total / N;
  double m = MOD;
  long long ans = 0;
  for (long long i = N; i >= 0; i--) {
    m = min(m, abs(a[i] - heikin));
    if (m == abs(a[i] - heikin)) ans = i;
  }
  cout << ans << endl;
  return 0;
}
