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