#include <bits/stdc++.h>
using namespace std;
long long const INF = 1LL << 60;
long long const MAX_N = 100000;
long long const MOD = 1000000007;
int main() {
  long long N;
  cin >> N;
  vector<double> a(N);
  for (long long i = 0; i < (N); i++) cin >> a[i];
  double avg = 0;
  for (long long i = 0; i < (N); i++) {
    avg += a[i];
  }
  avg /= (double)N;
  vector<pair<long long, double>> diff;
  for (long long i = 0; i < (N); i++) {
    pair<long long, double> p = make_pair(abs(avg - a[i]), i);
    diff.push_back(p);
  }
  sort(diff.begin(), diff.end());
  cout << diff[0].second << endl;
  return 0;
}
