#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  ll sum = 0;
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  double amean = sum / n;
  double diff = 1LL << 60, ans = -1;
  for (ll i = 0; i < n; i++) {
    if (abs(amean - a[i]) < diff) {
      diff = abs(amean - a[i]);
      ans = i;
    }
  }
  cout << ans << endl;
}
