#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int A[N];
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  long long s = 0;
  for (int i = 0; i < N; ++i) {
    s += A[i];
  }
  long long a = s / N;
  int ci = 0;
  long long cn = INT_MAX;
  for (int i = 0; i < N; ++i) {
    long long d = std::abs(A[i] - a);
    if (d < cn) {
      ci = i;
      cn = d;
    }
  }
  cout << ci << endl;
  return 0;
}
