#include <bits/stdc++.h>
using namespace std;
void yes() { cout << "Yes" << endl; }
void no() { cout << "No" << endl; }
int main() {
  long long n;
  cin >> n;
  double a[n];
  double sum = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  sum = sum / n;
  double min = 1000000;
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    double ax = sum - a[i];
    if (ax < 0) ax = ax * -1;
    if (ax < min) {
      ans = i;
    }
    min = ax;
  }
  cout << ans;
  return 0;
}
