#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll ZER = 0;
int main() {
  int n;
  cin >> n;
  vector<double> a(n);
  double ave = 0;
  for (int i = 0; (i) < (int)(n); i++) {
    cin >> a[i];
    ave += a[i];
  }
  ave /= n;
  ll res = 1e9, id = 0;
  for (int i = 0; (i) < (int)(n); i++) {
    if (res > abs(ave - a[i])) {
      res = abs(ave - a[i]);
      id = i;
    }
  }
  cout << id << endl;
}
