#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int n, ave = 0, ans = 0;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < (n); i++) {
    cin >> a[i];
    ave += a[i];
  }
  ave /= n;
  sort(a.begin(), a.end());
  for (int i = 0; i < (n); i++) {
    a[i] = abs(ave - a[i]);
  }
  for (int i = 1; i < n; i++) {
    if (a[ans] > a[i]) ans = i;
  }
  cout << ans << endl;
  return 0;
}
