#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  vector<int> A;
  cin >> N;
  A.resize(N);
  for (int i = 0; i < N; ++i) cin >> A[i];
  double meanValue = accumulate(A.begin(), A.end(), 0) / A.size();
  vector<double> distance(N, 0);
  for (int i = 0; i < N; ++i) {
    distance[i] = fabs(A[i] - meanValue);
  }
  std::vector<double>::iterator iter =
      std::min_element(distance.begin(), distance.end());
  int index = std::distance(distance.begin(), iter);
  cout << index << endl;
  return 0;
}
