#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int aaa, long long int bbb) {
  if (bbb == 0) {
    return aaa;
  }
  return gcd(bbb, aaa % bbb);
}
long long int lcm(long long int m, long long int n) {
  if ((0 == m) || (0 == n)) return 0;
  return ((m / gcd(m, n)) * n);
}
int main() {
  int N, sum = 0;
  cin >> N;
  int ans = N - 1;
  double a[N], tmp = 100, cmp;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    sum += a[i];
  }
  sum /= N;
  for (int i = N - 1; i >= 0; i--) {
    cmp = abs(sum - a[i]);
    if (tmp > cmp) {
      tmp = cmp;
    }
    if (tmp == abs(sum - a[i])) {
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}
