#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename T = ll>
inline T in() {
  T ret;
  cin >> ret;
  return ret;
}
int main() {
  ll n = in();
  double ave = 0;
  vector<ll> a(n);
  for (ll i = 0, i_len = (n); i < i_len; ++i) {
    a[i] = in();
    ave += a[i];
  }
  ave /= n;
  ll diff = 1e18;
  ll ind;
  for (ll i = 0, i_len = (n); i < i_len; ++i) {
    if (abs(ave - a[i]) < diff) {
      ind = i;
      diff = abs(ave - a[i]);
    }
  }
  cout << ind << endl;
}
