#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  vector<int> a;
  int input;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> input;
    a.push_back(input);
  }
  int ave = accumulate(a.begin(), a.end(), 0) / N;
  for (int i = 0; i < N; i++) {
    a[i] = abs(a[i] - ave);
  }
  vector<int>::iterator minIt = min_element(a.begin(), a.end());
  int minIndex = distance(a.begin(), minIt);
  cout << minIndex << endl;
  return 0;
}
