#include <bits/stdc++.h>
using namespace std;
signed main() {
  long double n;
  cin >> n;
  long double sum = 0.000000;
  long long e = (long long)n;
  long long a[e], b[e];
  for (long long i = 0; i < e; i++) {
    cin >> a[i];
    sum += a[i];
  }
  sum /= n;
  for (long long i = 0; i < e; i++) {
    long double l = a[i];
    b[i] = abs(sum - a[i]);
    a[i] = abs(sum - l);
  }
  sort(b, b + e);
  for (long long i = 0; i < e; i++) {
    if (a[i] == b[0]) {
      cout << i << endl;
      break;
    }
  }
  return 0;
}
