#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> v(n);
  long long sum = 0;
  for (long long(i) = (0); (i) < (n); ++i) {
    cin >> v[i];
    sum += v[i];
  }
  sum /= n;
  double mi = 1000000000;
  long long ret;
  for (long long(i) = (0); (i) < (n); ++i) {
    if (mi > abs(sum - v[i])) {
      mi = abs(sum - v[i]);
      ret = i;
    }
  }
  cout << ret << endl;
  return 0;
}
