#include <bits/stdc++.h>
using namespace std;
const int MAX = 510000;
const int MOD = 1000000007;
int main() {
  long long int i, j, k, l, m, sum, flag, N, M;
  sum = 0;
  flag = 0;
  cin >> N;
  vector<long long int> a(N);
  for (i = 0; i < N; i++) {
    cin >> a[i];
    sum += a[i];
  }
  double ave;
  ave = sum / N;
  long long int min;
  min = MOD;
  long long int ans;
  ans = N;
  for (i = N - 1; i >= 0; i--) {
    if (abs(a[i] - ave) <= min) {
      min = abs(a[i] - ave);
      ans = i;
    }
  }
  cout << ans << endl;
  ;
  return 0;
}
