#include <bits/stdc++.h>
int main(void) {
  int n;
  std::vector<int> a;
  std::cin >> n;
  for (int i = 0; i < n; i++) {
    int temp;
    std::cin >> temp;
    a.push_back(temp);
  }
  double average = std::accumulate(a.begin(), a.end(), 0.0) / a.size();
  std::vector<double> diff;
  for (int i = 0; i < n; i++) {
    diff.push_back(std::fabs(average - a[i]));
  }
  double smallest = diff[0];
  int idx = 0;
  for (int i = 1; i < n; i++) {
    if (smallest > diff[i]) {
      smallest = diff[i];
      idx = i;
    }
  }
  std::cout << idx << std::endl;
  return 0;
}
