#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  double ave = 1. * sum / n;
  int min_index = n;
  double distance_min = 1 << 10;
  for (int i = n - 1; i >= 0; i--) {
    if (abs((long)ave - a[i]) <= distance_min) {
      distance_min = abs((long)ave - a[i]);
      min_index = i;
    }
  }
  cout << min_index << endl;
  return 0;
}
