#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n;
  std::cin >> n;
  std::vector<double> a(n);
  double sum = 0;
  for (size_t i = 0; i < n; i++) {
    std::cin >> a[i];
    sum += a[i];
  }
  double ave = (double)sum / n;
  for (size_t i = 0; i < n; i++) {
    a[i] = abs(a[i] - ave);
  }
  int ans = -1;
  int mymin = sum;
  for (size_t i = 0; i < n; i++) {
    if (mymin > a[i]) {
      mymin = a[i];
      ans = i;
    }
  }
  std::cout << ans << '\n';
  return 0;
}
