#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p_i = pair<int, int>;
int main() {
  int N;
  cin >> N;
  double sum = 0;
  vector<double> a(N);
  for (int i = 0; i < N; ++i) {
    cin >> a[i];
    sum += a[i];
  }
  double ave = sum / N;
  double d = abs(ave - a[0]), dd = d;
  bool ok = false;
  int ans = -1;
  for (int i = 0; i < N; ++i) {
    if (d != abs(ave - a[i])) {
      ok = true;
    }
    if (ave - a[i] == 0) {
      cout << i << endl;
      return 0;
    }
    if (dd > abs(ave - a[i])) {
      dd = abs(ave - a[i]);
      ans = i;
    }
  }
  if (!ok) {
    cout << 0 << endl;
    return 0;
  }
  cout << ans << endl;
}
