#include <bits/stdc++.h>
int main() {
  int n;
  int sum = 0;
  double avrg;
  std::cin >> n;
  std::vector<int> v(n);
  for (int i = 0; i < n; i++) {
    std::cin >> v[i];
    sum = sum + v[i];
  }
  avrg = sum / n;
  double min_error = abs(v[0] - avrg);
  int min_number = 0;
  for (int i = 0; i < n; i++) {
    if (min_error > abs(v[i] - avrg)) {
      min_error = abs(v[i] - avrg);
      min_number = i;
    }
  }
  std::cout << min_number << std::endl;
  return 0;
}
