#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
void solve() {
  long long n;
  cin >> n;
  long long sum = 0;
  vector<long long> v(n);
  for (long long i = 0; i < n; ++i) {
    cin >> v[i];
    sum += v[i];
  }
  double avg = (sum * 1.0) / n;
  long long diff = 1e10, id = -1;
  for (long long i = 0; i < n; i++) {
    if (diff > abs(v[i] - avg)) {
      diff = abs(v[i] - avg);
      id = i;
    }
  }
  cout << id << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long t = 1;
  while (t--) solve();
  return 0;
}
