#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<double> a(N);
  for (int i = 0; i < (int)(N); i++) cin >> a[i];
  double sum = 0;
  for (int i = 0; i < (int)(N); i++) sum += a[i];
  double avg = sum / N;
  int ans = 0;
  int min = 100000;
  for (int i = 0; i < (int)(N); i++) {
    if (abs(a[i] - avg) < min) {
      ans = i;
      min = abs(a[i] - avg);
    }
  }
  cout << ans << endl;
  return 0;
}
