#include <bits/stdc++.h>
using namespace std;
struct cww {
  cww() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  }
} star;
const long long INF = numeric_limits<long long>::max();
int main() {
  int N, sum = 0;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < (N); i++) {
    cin >> a[i];
    sum += a[i];
  }
  double ave = (double)sum / (double)N;
  int dif = INT_MAX, ans = 0;
  for (int i = N - 1; i >= 0; i--) {
    if (dif >= abs(a[i] - ave)) {
      ans = i;
      dif = abs(a[i] - ave);
    }
  }
  cout << ans;
  return 0;
}
