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