#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, sum = 0;
  cin >> N;
  vector<int> a(N);
  vector<int> b(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    sum += a[i];
    a[i] *= N;
    b[i] = a[i];
  }
  sort(a.begin(), a.end());
  int min = sum * N;
  for (int i = 0; i < N; i++) {
    if (min > abs(sum - a[i])) {
      min = abs(sum - a[i]);
    } else {
      break;
    }
  }
  for (int i = 0; i < b.size(); i++) {
    if (b[i] == sum - min) {
      cout << i << endl;
      break;
    }
  }
  return 0;
}
