#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[1100], s = 0, ans;
  float b, d = 999999999, e;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    s += a[i];
  }
  b = s / n;
  for (int i = 0; i < n; i++) {
    if (a[i] > b)
      e = a[i] - b;
    else
      e = b - a[i];
    if (e < d) {
      d = e;
      ans = i;
    }
  }
  cout << ans << endl;
}
