#include <bits/stdc++.h>
int main() {
  int n;
  std::cin >> n;
  std::vector<int> a(n);
  int sum = 0;
  for (auto& ai : a) {
    std::cin >> ai;
    sum += ai;
  }
  int average = sum / n;
  for (auto& ai : a) {
    ai = std::abs(ai - average);
  }
  int min = a[0];
  int min_idx = 0;
  for (auto ai = 0; ai < n; ++ai) {
    if (a[ai] < min) {
      min = a[ai];
      min_idx = ai;
    }
  }
  std::cout << min_idx << std::endl;
  return 0;
}
