#include <bits/stdc++.h>
using namespace std;
signed main(void) {
  int n, sum, ans;
  cin >> n;
  int a[n];
  sum = 0;
  for (int i = 0; i < (n); i++) {
    cin >> a[i];
    sum += a[i];
  }
  double ave, mn;
  ave = sum / n;
  mn = 1e9;
  for (int i = 0; i < (n); i++) {
    double b = abs((double)ave - a[i]);
    if (mn > b) {
      mn = b;
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}
