#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
int main(int argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  vector<ll> a(N);
  for (ll i = 0; i < (N); i++) {
    cin >> a[i];
  }
  double average = 0;
  for (ll i = 0; i < (N); i++) {
    average += a[i];
  }
  average /= N;
  ll tmp = INT_MAX;
  ll ans = 0;
  for (ll i = 0; i < (N); i++) {
    if (abs(a[i] - average) < tmp) {
      tmp = abs(a[i] - average);
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}
