#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  vector<int> a;
  cin >> N;
  int sum = 0;
  a = vector<int>(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    sum += a[i];
  }
  double average = (double)sum / N;
  double min_dist = abs(average - a[0]);
  int min_i = 0;
  for (int i = 1; i < N; i++) {
    double dist = abs(average - a[1]);
    if (dist < min_dist) {
      min_dist = dist;
      min_i = i;
    }
  }
  cout << min_i << endl;
  return 0;
}
