#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < (n); i++) cin >> a.at(i);
  double sum = 0;
  for (int i = 0; i < (n); i++) sum += a.at(i);
  sum /= n;
  int ans;
  int num = 10000000;
  for (int i = 0; i < (n); i++) {
    if (abs(sum - a.at(i)) < num) {
      num = abs(sum - a.at(i));
      ans = i;
    }
  }
  cout << ans << endl;
}
