#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, a[1000], sum[1000], mp = 10000000000000ll, cun = 0, b = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    cun += a[i];
  }
  cun = cun / n;
  for (int i = 0; i < n; i++) {
    sum[i] = abs(a[i] - cun);
    if (mp > sum[i]) {
      mp = sum[i];
      b = i;
    }
  }
  cout << b << "\n";
}
