#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
signed main() {
  long long n;
  cin >> n;
  vector<double> a(n);
  double sum = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  double ans = sum / n;
  long long sa = 1e9;
  long long id = 0;
  for (long long i = 0; i < n; i++) {
    if (sa > abs(ans - a[i])) {
      sa = abs(ans - a[i]);
      id = i;
    }
  }
  cout << id << endl;
}
