#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  double ave = sum / n;
  double b[n];
  int samne = 10000000;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    b[i] = a[i] - ave;
    if (b[i] < 0) b[i] = -b[i];
    if (b[i] < samne) {
      ans = i;
    }
  }
  cout << ans << endl;
}
