#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int sum = 0;
  int i;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  double ave = (double)(sum / n);
  int min_diff = 100000, min_index = -1;
  for (i = 0; i < n; i++) {
    if (fabs((double)(a[i] - ave)) < min_diff) {
      min_diff = fabs((double)(a[i] - ave));
      min_index = i;
    }
  }
  cout << min_index << endl;
  return 0;
}
