#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  double total = 0;
  int A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    total += A[i];
  }
  total /= N;
  int best = 0x3f3f3f3f;
  int ans = -1;
  for (int i = 0; i < N; i++) {
    double diff = abs(A[i] - total);
    if (diff < best) {
      best = diff;
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}
