#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  double average = accumulate(a.begin(), a.end(), 0) / n;
  double d = numeric_limits<double>::max();
  int f;
  for (int i = 0; i < n; i++) {
    if (fabs(average - a[i]) < d) {
      d = fabs(average - a[i]);
      f = i;
    }
  }
  cout << f << endl;
  return 0;
}
