#include <bits/stdc++.h>
using namespace std;
void vout(vector<long long int> v) {
  for (int i = 0; i < v.size(); i++) cout << v.at(i) << endl;
}
int main() {
  double n;
  cin >> n;
  double ave = 0;
  vector<double> a((long long int)n);
  for (int i = 0; i < (int)(n); i++) {
    double an;
    cin >> an;
    a[i] = an;
    ave += an;
  }
  ave /= n;
  double d = 10000000000;
  long long int rec = 10000000000;
  for (int i = 0; i < (int)(n); i++) {
    if (d > abs(a[i] - ave)) {
      d = abs(a[i] - ave);
    } else {
      if (d == abs(a[i] - ave)) {
        if (rec == 10000000000) {
          rec = i - 1;
        }
      } else {
        rec = i - 1;
      }
    }
  }
  cout << rec << endl;
  ;
}
