#include <bits/stdc++.h>
using namespace std;
long long const INF = 1LL << 60;
int main() {
  long long N;
  cin >> N;
  vector<long long> a(N);
  long long sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    sum += a[i];
  }
  long long mean = sum / N;
  long long min_diff = INF, min_id;
  for (int i = 0; i < N; i++) {
    if (abs(mean - a[i]) < min_diff) {
      min_diff = abs(mean - a[i]);
      min_id = i;
    }
  }
  cout << min_id << endl;
  return 0;
}
