#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, i, ans = 0;
  double avr = 0, eps = 100000.0;
  cin >> n;
  vector<double> a(n);
  for (i = 0; i < n; ++i) {
    cin >> a[i];
    avr += a[i];
  }
  avr /= n;
  for (i = 0; i < n; i++) {
    if (eps > abs(avr - a[i])) {
      ans = i;
      eps = abs(avr - a[i]);
    }
  }
  cout << ans << "\n";
  return 0;
}