#include <bits/stdc++.h>
using namespace std;
const long long LLINF = (1LL << 60);
const long long INF = (1LL << 30);
const double DINF = std::numeric_limits<double>::infinity();
const long long MOD = 1000000007;
signed main() {
  long long N;
  cin >> N;
  long long avg = 0;
  vector<double> A(N, 0);
  for (long long i = 0; i < N; ++i) {
    cin >> A[i];
    avg += A[i];
  }
  avg /= static_cast<double>(N);
  pair<long long, double> ans = make_pair(0, A[0]);
  for (long long i = 1; i < N; ++i) {
    if (abs(avg - ans.second) > abs(avg - A[i])) {
      ans = make_pair(i, A[i]);
    }
  }
  printf("%lld\n", ans.first);
  return 0;
}
