#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  double ave = 0.0;
  for (long long i = 0; i < n; i++) {
    ave += a[i];
  }
  ave /= n;
  long long p = 0;
  long long diff = abs(ave - a[0]);
  for (long long i = 1; i < n; i++) {
    long long res = abs(ave - a[i]);
    if (res < diff) p = i;
  }
  cout << p << endl;
  return 0;
}
