#include <bits/stdc++.h>
const int mod = 1e9 + 7;
int main() {
  int n;
  std::cin >> n;
  std::vector<int> a(n);
  for (int i = 0; i < n; i++) {
    std::cin >> a[i];
  }
  int ave = std::accumulate(a.begin(), a.end(), 0) / a.size();
  int min_diff = INT_MAX;
  int min_idx = 0;
  for (int i = 0; i < n; i++) {
    if (std::abs(a[i] - ave) < min_diff) {
      min_diff = std::abs(a[i] - ave);
      min_idx = i;
    }
  }
  std::cout << min_idx << std::endl;
}
