#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < (long long)n; i++) cin >> v.at(i);
  long double ave = 0;
  for (long long i = 0; i < (long long)n; i++) {
    ave += v[i];
  }
  ave = ave / n;
  long long po = 0;
  long long minf = 1e9;
  for (long long i = 0; i < (long long)n; i++) {
    if (minf > abs(ave - v[i])) {
      minf = abs(ave - v[i]);
      po = i;
    }
  }
  cout << po << endl;
}
