#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 aver = sum / n;
  double mn = fabs(aver - a[0]);
  int index = 0;
  for (int i = 1; i < n; i++) {
    if (fabs(aver - a[i]) < mn) {
      mn = fabs(aver - a[i]);
      index = i;
    }
  }
  cout << index << endl;
  return 0;
}
