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