#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  double ave = 0;
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
    ave += a[i];
  }
  ave /= n;
  ll ans = 0;
  ll ming = 10000000000;
  for (ll i = 0; i < n; i++) {
    double gap = a[i] - ave;
    if (gap < 0) {
      gap *= -1;
    }
    if (gap < ming) {
      ming = gap;
      ans = i;
    }
  }
  cout << ans << endl;
}
