#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  int A[N];
  long long sum = 0;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    sum += A[i];
  }
  int diff = 1000;
  int ans = 0;
  float ave = (float)sum / N;
  for (int i = 0; i < N; i++) {
    if (diff > (abs(A[i] - ave))) {
      diff = abs(A[i] - ave);
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}
