#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto& e : a) cin >> e;
  double ave = accumulate(a.begin(), a.end(), 0) / n * 1.0;
  int itr = 0;
  for (int i = 0; i < n; ++i) {
    if (abs(a[itr] - ave) > abs(a[i] - ave)) {
      itr = i;
    }
  }
  cout << itr << endl;
  return 0;
}
