#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) cin >> a[i];
  int sum = 0;
  for (int x : a) {
    sum += x;
  }
  double ave = sum / N;
  int ans = N - 1;
  for (int i = N - 1; i >= 0; i--) {
    if (abs(a[ans] - ave) >= abs(a[i] - ave)) ans = i;
  }
  cout << ans << endl;
  return 0;
}
