#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

#define taskname "merlin"

int n;
vector<long long> prefix_sum;
vector<long long> suffix_sum;

long long get_prefix_sum(int l)
{
    if (l < 0)
        return 0;
    return prefix_sum[l];
} 

long long get_suffix_sum(int r)
{
    if (r >= n)
        return 0;
    return suffix_sum[r];
}

int main()
{
    freopen(taskname".in", "r", stdin);
    freopen(taskname".out", "w", stdout);
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    sort(a.begin(), a.end());
    prefix_sum.resize(n); 
    suffix_sum.resize(n);
    prefix_sum[0] = a[0];
    for (int i = 1; i < n; i++)
        prefix_sum[i] = prefix_sum[i - 1] + a[i];
    suffix_sum[n - 1] = a[n - 1];
    for (int i = n - 2; i >= 0; i--)
        suffix_sum[i] = suffix_sum[i + 1] + a[i];
    int ans = 0;
    while (ans < n) 
    {
        int k = n - ans - 1;
        if (1ll * k * a[k] - get_prefix_sum(k - 1) <= get_suffix_sum(k + 1))
            break;
        ans++;
    }
    cout << ans << endl;
    return 0;
}
