#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int ave = 0;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    int a_i;
    cin >> a_i;
    ave += a_i;
    a[i] = a_i;
  }
  ave /= N;
  for (int i = 0; i < N; i++) {
    a[i] = abs(a[i] - ave);
  }
  int ans = 0;
  int min_diff = INT_MAX;
  for (int i = 0; i < N; i++) {
    if (a[i] < min_diff) {
      ans = i;
      min_diff = a[i];
    }
  }
  cout << ans << endl;
}
