#include <bits/stdc++.h>
using namespace std;
using II = pair<long long, long long>;
using VII = vector<II>;
using VI = vector<long long>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
template <class T = long long>
inline bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T = long long>
inline bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
ostream &operator<<(ostream &s, const vector<T> &d) {
  long long n = d.size();
  for (long long i = 0, max_i = (n); i < max_i; i++) s << d[i] << " ";
  return s;
}
template <class T>
ostream &operator<<(ostream &s, const vector<vector<T>> &dd) {
  for (vector<T> d : dd) s << d << endl;
  return s;
}
template <class T, class S>
ostream &operator<<(ostream &s, const pair<T, S> &p) {
  s << "{" << p.first << ", " << p.second << "}";
  return s;
}
struct Fast {
  Fast() {
    cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
const long long MOD = 1e9 + 7;
double EPS = 1e-5;
signed main() {
  long long N;
  cin >> N;
  vector<double> a(N);
  double to = 0;
  for (long long i = 0, max_i = (N); i < max_i; i++) {
    cin >> a[i];
    to += a[i];
  }
  to /= N;
  sort((a).begin(), (a).end());
  a.push_back(1e10);
  for (long long i = 0, max_i = (N); i < max_i; i++) {
    if (a[i] > to) {
      if (a[i] - to > to - a[i - 1] - EPS) {
        i--;
        while (i > 0 && a[i] == a[i - 1]) i--;
        cout << i << endl;
      } else {
        cout << i << endl;
      }
      return 0;
    }
  }
}
