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