#include <bits/stdc++.h>
using namespace std;
long long N;
int main() {
  cin >> N;
  vector<long long> a;
  vector<pair<double, 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;
  int ans = 0;
  double min_dif = 1000000000;
  for (int i = 0; i < N; i++) {
    double dif = abs(a[i] - ave);
    if (min_dif > dif) {
      min_dif = dif;
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}
