#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  for (int i = 0; i < n; i++) {
    int tmp = 0;
    cin >> tmp;
    vec.push_back(tmp);
  }
  if (vec.size() == 1) {
    cout << 0 << endl;
    exit(0);
  }
  long int avg =
      (float)accumulate(vec.begin(), vec.end(), 0) / (float)vec.size();
  int mi = 0;
  float m_from_avg = abs(avg - vec[0]);
  for (size_t i = 1; i < n; i++) {
    float tmp = abs(avg - vec[i]);
    if (tmp < m_from_avg) {
      m_from_avg = tmp;
      mi = i;
    }
  }
  cout << mi << endl;
  return 0;
}
