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