#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, sum = 0, m;
  cin >> n;
  int a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  int k = sum / n;
  for (i = 0; i < n; i++) {
    if (a[i] == k) {
      cout << i << endl;
      return 0;
    }
  }
  int p = INT_MAX;
  for (i = n - 1; i >= 0; i--) {
    if (abs(a[i] - k) <= p) m = i, p = abs(a[i] - k);
  }
  cout << m << endl;
}
