#include <bits/stdc++.h>
int main() {
  int n;
  std::cin >> n;
  std::vector<int> a(n);
  for (int i = 0; i < n; i++) {
    std::cin >> a[i];
  }
  double ave = (double)std::accumulate(a.begin(), a.end(), 0.0) / n;
  double min_diff = DBL_MAX;
  int min_idx = 0;
  for (int i = 0; i < n; i++) {
    if (min_diff > std::labs(ave - a[i])) {
      min_idx = i;
      min_diff = std::labs(ave - a[i]);
    }
  }
  std::cout << min_idx << std::endl;
}
