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