#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n], sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  double ave = sum / n;
  int mi = INT_MAX, ind;
  for (int i = 0; i < n; i++) {
    if (mi > abs(a[i] - ave)) {
      mi = abs(a[i] - ave);
      ind = i;
    }
  }
  cout << ind << endl;
  return 0;
}
