#include <bits/stdc++.h>
int main() {
  int n = 0;
  double mean = 0;
  std::cin >> n;
  std::vector<int> v(n);
  for (int i = 0; i < n; i++) {
    std::cin >> v[i];
    mean += v[i];
  }
  mean /= n;
  std::vector<double> d(n);
  for (int i = 0; i < n; i++) d[i] = fabs(v[i] - mean);
  std::vector<int> idx(n);
  std::iota(idx.begin(), idx.end(), 0);
  std::sort(idx.begin(), idx.end(), [&](int x, int y) { return d[x] < d[y]; });
  std::cout << idx[0] << std::endl;
  return 0;
}
