#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> frames(N);
  int sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> frames[i];
    sum += frames[i];
  }
  float average = sum / N;
  vector<double> dists(N);
  double min_val = 9999999;
  int idx = 0;
  for (int i = 0; i < N; i++) {
    if (min_val > fabs(average - frames[i])) {
      idx = i;
      min_val = fabs(average - frames[i]);
    }
  }
  cout << idx << endl;
}
