算法1:贪心-排序() $O(NlogN)$
//贪心-按照时间排序,不满意的人的时间就不要累加了 反正已经不满意了
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+10;
int a[N], n;
int main() {
scanf("%d", &n);
for (int i = 0; i < n; ++ i) scanf("%d", &a[i]);
sort(a, a+n);
int res = 0;
long long s = 0; //总和有可能爆int
for (int i = 0; i < n; ++ i)
if (a[i] >= s) {
s += a[i];
res ++;
}
printf("%d", res);
return 0;
}