#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int a[N];
  int sum = 0;
  for (int i = 0; i < N; i++) cin >> a[i], sum += a[i];
  int ave = sum / N;
  int mn = INT_MAX;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (mn > abs(a[i] - ave)) {
      mn = abs(a[i] - ave);
      ans = i;
    }
  }
  cout << ans << endl;
}
