#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long int n;
  cin >> n;
  vector<double> a(n);
  long long int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  vector<pair<double, int>> b(n);
  for (int i = 0; i < n; i++) {
    b[i] = make_pair(abs(a[i] - sum / n), i);
  }
  sort(b.begin(), b.end());
  cout << b[0].second << endl;
  return 0;
}
