#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll solve() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  ll s = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    s += A[i];
  }
  ll ave = s / N;
  ll m = 1000, ix = 0;
  for (int i = 0; i < N; i++) {
    ll x = min(abs(A[i] - ave), abs(A[i] - (ave + 1)));
    if (m > x) {
      m = x;
      ix = i;
    }
  }
  return ix;
}
int main() {
  auto ans = solve();
  cout << ans << "\n";
  return 0;
}
