#include <bits/stdc++.h>
using namespace std;
void solve(long long N, std::vector<long long> a, long long sum) {
  long double avg = (long double)sum / N;
  long long mymin = LLONG_MAX;
  long long minidx;
  for (long long i = 0; i < N; i++) {
    if (mymin > abs(avg - a[i])) {
      mymin = abs(avg - a[i]);
      minidx = i;
    }
  }
  cout << minidx << endl;
}
int main() {
  long long N, sum = 0;
  scanf("%lld", &N);
  std::vector<long long> a(N - 1 - 0 + 1);
  for (int i = 0; i < N - 1 - 0 + 1; i++) {
    scanf("%lld", &a[i]);
    sum += a[i];
  }
  solve(N, std::move(a), sum);
  return 0;
}
