#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) cin >> a[i];
  double avg = 0;
  for (int i = 0; i < N; i++) avg += a[i];
  avg = avg / N;
  double dif = 1000000000;
  int ans = -1;
  for (int i = 0; i < N; i++) if (abs(a[i] - avg) < dif) dif = abs(a[i] - avg), ans = i;
  cout << ans << endl;
}