#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, sum = 0, ave, ans;
  double m;
  cin >> N;
  int a[N];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    sum += a[i];
  }
  ave = sum / N;
  for (int i = 0; i < N; i++) {
    if (i == 0) m = abs(a[0] - ave);
    if (m > abs(ave - a[i])) ans = i;
  }
  cout << ans << endl;
}
