#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, sum = 0, t_i;
  double t = 10000;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  t = (((double)sum / n - (double)a[0]) < 0
           ? (-((double)sum / n - (double)a[0]))
           : (((double)sum / n - (double)a[0])));
  t_i = 0;
  for (int i = 1; i < n; i++) {
    if ((((double)sum / n - (double)t) < 0 ? (-((double)sum / n - (double)t))
                                           : (((double)sum / n - (double)t))) >
        (((double)sum / n - (double)a[i]) < 0
             ? (-((double)sum / n - (double)a[i]))
             : (((double)sum / n - (double)a[i])))) {
      t = a[i];
      t_i = i;
    }
  }
  cout << t_i << endl;
  return 0;
}
