#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long sum = 0;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  sum /= n;
  int ans = -1;
  long long sa = 10000;
  for (int i = 0; i < n; i++) {
    if (sa >
        (((a[i] - sum)) > (-(a[i] - sum)) ? ((a[i] - sum)) : (-(a[i] - sum)))) {
      sa =
          (((a[i] - sum)) > (-(a[i] - sum)) ? ((a[i] - sum)) : (-(a[i] - sum)));
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}
