#include<bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  double a[n];
  double add = 0;
  for(int i = 0; i < n; ++i) {
    cin >> a[i];
    add += a[i];
  }
  double h = (double)add / n;
  double s = 1000, pos;
  for(int i = n - 1; i >= 0; --i) {
    if(s >= fabs(h - a[i])) { s = fabs(h - a[i]); pos = i; }
  }

  cout << pos << endl;
  return 0;
}