#include <bits/stdc++.h>
using namespace std;
int main(void) {
  float n;
  float sum = 0;
  cin >> n;
  vector<float> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  sum /= n;
  float dif = 1000000;
  int key = -1;
  for (int i = 0; i < n; i++) {
    if (dif > abs(sum - a[i])) {
      dif = abs(sum - a[i]);
      key = i;
    }
  }
  cout << key << endl;
  return 0;
}
