#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  int sum = 0;
  vector<int> A(N);
  for (int(i) = 0; (i) < (N); (i)++) {
    cin >> A[i];
    sum += A[i];
  }
  int dif = INF;
  int res = N - 1;
  for (int i = N - 1; i >= 0; i--) {
    if (abs(A[i] * N - sum) <= dif) {
      dif = abs(A[i] * N - sum);
      res = i;
    }
  }
  cout << res << endl;
  return 0;
}
