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