#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
int n;
int main() {
  cin >> n;
  vector<int> a(n);
  int sum = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  for (long long i = 0; i < n; i++) {
    a[i] *= n;
    a[i] = abs(sum - a[i]);
  }
  int m = INT_MAX;
  int res = 0;
  for (long long i = 0; i < n; i++) {
    if (chmin(n, a[i])) {
      res = i;
    }
  }
  cout << res << "\n";
  ;
  return 0;
}
