#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  cin >> N;
  double num = N;
  double a[N];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  double sum = 0;
  for (int i = 0; i < N; i++) {
    sum += a[i];
  }
  sum = sum / num;
  double min = 10000000;
  double ans = 0;
  for (int i = 0; i < N; i++) {
    double gap = abs(a[i] - sum);
    if (gap < min) {
      min = gap;
      ans = i;
    }
  }
  cout << ans;
  return 0;
}
