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