#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<double> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  double s = 0;
  for (int i = 0; i < n; i++) s += a[i];
  s = s / n;
  double d = s - a[0];
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (d > abs(s - a[i])) {
      ans = i;
      d = abs(s - a[i]);
    }
  }
  cout << ans << endl;
  return 0;
}
