#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  int sum = accumulate(v.begin(), v.end(), 0);
  int target = sum / n;
  int sol = 0, razlika = 1e9;
  for (int i = 0; i < n; i++) {
    if (abs(v[i] - target) < razlika) {
      sol = i;
      razlika = abs(v[i] - target);
    }
  }
  cout << sol;
}
