#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  vector<double> v(n);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    sum += v[i];
  }
  int ave = sum / n;
  for (int i = 0; i < n; i++) {
    v[i] -= ave;
  }
  auto iter = min_element(v.begin(), v.end());
  cout << distance(v.begin(), iter) << endl;
  return 0;
}
