#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];
  }
  long long sa = 0, tmp = 0, ans = 0;
  for (long long i = N; i > 0; i--) {
    sa = abs(total - a[i] * N);
    tmp = min(sa, tmp);
    if (tmp == sa) ans = i;
  }
  cout << ans << endl;
  return 0;
}
