#include <bits/stdc++.h>
using namespace std;
int64_t MOD = 1000000007;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  double n;
  cin >> n;
  vector<double> vec(n);
  for (double i = 0; i < n; i++) cin >> vec[i];
  double ave = 0;
  for (double i = 0; i < n; i++) ave += vec[i];
  ave /= n;
  double ans;
  for (double i = 0; i < n - 1; i++)
    if (abs(vec[i] - ave) < abs(vec[i + 1] - ave)) ans = i;
  cout << ans << endl;
}
