#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  long long a[N];
  for (long long i = 0; i < N; ++i) cin >> a[i];
  float mean = 0;
  for (long long i = 0; i < (long long)(N); i++) {
    mean += (float)a[i];
  }
  mean = mean / N;
  float a_abs[N];
  float min_abs = 100000000000;
  long long ans = (long long)1e18;
  for (long long i = 0; i < (long long)(N); i++) {
    a_abs[i] = abs(a[i] - mean);
    if (a_abs[i] < min_abs) {
      min_abs = a_abs[i];
      ans = i;
    }
  }
  cout << ans;
}
