#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  vector<pair<int, int>> a(N);
  cin >> N;
  for (int i = 0; i < N; ++i) {
    cin >> a[i].first;
    a[i].first *= N;
    a[i].second = i;
  }
  sort(a.begin(), a.end());
  int acc = 0;
  for (auto &&e : a) acc += e.first;
  int mean = acc / N;
  auto it = lower_bound(a.begin(), a.end(), make_pair(mean, 0));
  int ans;
  if (it == a.begin()) {
    ans = it->second;
  } else {
    int ud = it->first - mean, dd = mean - (it - 1)->first;
    if (ud >= dd) {
      auto itt = lower_bound(a.begin(), a.end(), make_pair((it - 1)->first, 0));
      if (ud == dd) {
        ans = it->second > itt->second ? itt->second : it->second;
      } else {
        ans = itt->second;
      }
    } else {
      ans = it->second;
    }
  }
  cout << ans << endl;
  return 0;
}
