#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(std::numeric_limits<float>::max_digits10);
  int n;
  vector<int> a(n);
  cin >> n;
  for (int(i) = 0; (i) < (n); (i)++) cin >> a[i];
  int s = accumulate(a.begin(), a.end(), 0);
  int d = 1000000;
  int idx = 0;
  for (int(i) = 0; (i) < (n); (i)++) {
    if (abs(s - n * a[i]) < d) {
      idx = i;
      d = abs(s - n * a[i]);
    }
  }
  cout << idx << endl;
  return 0;
}
