Little girl Susie went shopping with her mom and she wondered how to improve service quality. 

There are n people in the queue. For each person we know time t_{i} needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when all the people who stand in the queue in front of him are served. Susie thought that if we swap some people in the queue, then we can decrease the number of people who are disappointed. 

Help Susie find out what is the maximum number of not disappointed people can be achieved by swapping people in the queue.


-----Input-----

The first line contains integer n (1 ≤ n ≤ 10^5).

The next line contains n integers t_{i} (1 ≤ t_{i} ≤ 10^9), separated by spaces.


-----Output-----

Print a single number — the maximum number of not disappointed people in the queue.


-----Examples-----
Input
5
15 2 1 5 3

Output
4



-----Note-----

Value 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.

Difficulty: EASY

Solutions:
n = int(input())
a = list(map(int, input().split()))
a.sort()
r = 0
ac = 0
for k in range(n):
	if ac <= a[k]:
		r += 1
		ac += a[k]
print(r)


n = int(input())
l = input().split()
a = []
for i in range(0, n):
	a.append(int(l[i]))
t = 0
out = 0
a.sort()
for i in range(0, n):
	if a[i] >= t:
		t += a[i]
		out += 1
	else:
		out += 0
print(out)


n = int(input())
lista = input()
lista = lista.split()
for i in range(len(lista)):
	lista[i] = int(lista[i])
lista.sort()
wynik = 0
licznik = 0
for i in range(n):
	if int(lista[i]) >= licznik:
		licznik += int(lista[i])
		wynik += 1
print(wynik)


n = int(input())
l = list(map(int, input().split()))
l.sort()
p = [l[0]]
k = l[0]
for i in range(1, n):
	if l[i] >= k:
		p.append(l[i])
		k += l[i]
print(len(p))


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
total = 0
c = 0
for i in range(n):
	if a[i] < total:
		continue
	else:
		total += a[i]
		c += 1
print(c)


n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
t = 0
for i in range(n):
	if t <= a[i]:
		t += a[i]
	else:
		ans += 1
print(n - ans)


n = int(input())
l = list(map(int, input().split()))
ans = 0
sum = 0
l.sort()
for i in l:
	if sum > i:
		continue
	else:
		sum += i
		ans += 1
print(ans)


n = int(input())
a = sorted(map(int, input().split()))
c = 0
t = 0
for i in range(n):
	if t <= a[i]:
		c += 1
		t += a[i]
print(c)


N = int(input())
T = list(map(int, input().split()))
T.sort()
now = 0
ans = 0
for t in T:
	if now <= t:
		ans += 1
		now += t
print(ans)


n = int(input())
a = [int(i) for i in input().split()]
a = sorted(a)
ans = 0
time = 0
for i in a:
	if time <= i:
		ans += 1
		time += i
print(ans)


__author__ = 'dwliv_000'
n = int(input())
g = [int(i) for i in input().split()]
t = 0
k = 0
q = sorted(g)
e = 0
h = 0
sum = 0
for e in range(0, n):
	if q[e] >= sum:
		sum += q[e]
		h = h + 1
print(h)


import sys
texto = sys.stdin.read().split('\n')
texto.pop(-1)
n = texto[0]
n = int(n)
espera = [int(x) for x in texto[1].split(' ')]
satisfechos = 0
total = 0
espera.sort()
for t in range(len(espera)):
	if total <= espera[t]:
		satisfechos += 1
		total += espera[t]
print(satisfechos)


n = input()
s = input()
a = s.split()
for i in range(len(a)):
	a[i] = int(a[i])
a.sort()
sum = 0
count = 0
for i in a:
	if i < sum:
		continue
	sum += i
	count += 1
print(count)


n = input()
members = sorted(list(map(int, input().split(' '))))
s = c = 0
for mem in members:
	if s <= mem:
		c += 1
		s += mem
print(c)


n = int(input())
a = list(map(int, input().split()))
a.sort()
s = a[0]
i = 1
disappointed = 0
while i < n:
	if s > a[i]:
		disappointed += 1
		s -= a[i]
	s += a[i]
	i += 1
print(n - disappointed)


n = int(input())
t = list(map(int, input().split()))
tmp = [0] * n
cnt1 = 1
cnt2 = 0

def counting_sort(array, maxval):
	m = maxval + 1
	count = [0] * m
	for a in array:
		count[a] += 1
	i = 0
	for a in range(m):
		for c in range(count[a]):
			array[i] = a
			i += 1
	return array
if max(t) > 500000:
	t.sort()
else:
	t = counting_sort(t, max(t))

def foo(x, n):
	tmp = [0] * n
	cnt2 = 1
	for i in range(1, n):
		tmp[i] = sum(x[:i])
		if tmp[i] <= x[i]:
			cnt2 += 1
	return cnt2
c = 0
for i in range(n):
	if t[i] >= c:
		cnt2 += 1
		c += t[i]
print(cnt2)


a = int(input())
x = list(map(int, input().split()))
x.sort()
z = 0
o = 0
m = len(x)
while z < a:
	if x[z] < o:
		m = m - 1
		o = o - x[z]
	o = o + x[z]
	z = z + 1
print(m)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from functools import cmp_to_key
from heapq import *
from math import gcd, factorial, floor, ceil
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
inf = pow(10, 20)
mod = 10 ** 9 + 7

def solve(case):
	n = int(inp())
	a = lis()
	a = sorted(a)
	deq = deque([])
	for i in range(n):
		deq.append(a[i])
	ans = 0
	curr = 0
	for i in range(n):
		el = deq.popleft()
		if el >= curr:
			curr += el
		else:
			ans += 1
	print(n - ans)
testcase(1)


I = lambda : map(int, input().split())
n = int(input())
l = list(I())
l.sort()
total = count = 0
for i in range(n):
	if l[i] >= total:
		count += 1
		total += l[i]
print(count)


n = int(input())
a = list(map(int, input().strip().split(' ')))
a.sort()
t = 0
cnt = 0
for i in a:
	if t <= i:
		cnt += 1
		t += i
print(cnt)


N = int(input())
T = list(map(int, input().split()))
T.sort()
sum = 0
cnt = 0
for i in range(0, N):
	if sum <= T[i]:
		cnt += 1
		sum += T[i]
print(cnt)


n = int(input())
t = [int(x) for x in input().split()]
t.sort()
(u, s) = (0, 0)
for x in t:
	if s <= x:
		u += 1
		s += x
print(u)


n = int(input())
li = list(map(int, input().split()))
ans = 0
s = 0
li.sort()
for i in li:
	if s <= i:
		s += i
		ans += 1
print(ans)


comp = [0]
n = int(input())
satis = 0
valores = list(map(int, input().strip().split()))
valores.sort()
tiempo = 0
for valor in valores:
	if valor >= tiempo:
		tiempo += valor
		satis += 1
	else:
		continue
print(satis)


n = int(input())
arr = [int(i) for i in input().split(' ')]
arr.sort()
tem = 0
count = 0
for i in range(n):
	if arr[i] >= tem:
		count += 1
		tem += arr[i]
print(count)


n = int(input())
cont = 0
tempo = 0
L = []
for x in input().split(' '):
	L.append(int(x))
L.sort()
for i in range(0, len(L)):
	if L[i] >= tempo:
		cont += 1
		tempo += L[i]
print(cont)


n = int(input())
arr = list(map(int, input().split(' ')))
arr.sort()
sum = arr[0]
count = 1
for i in range(1, len(arr)):
	if sum <= arr[i]:
		count += 1
		sum += arr[i]
	else:
		continue
print(count)


import heapq

def CF545D():
	N = int(input())
	people = list(map(int, input().split()))
	heapq.heapify(people)
	time = 0
	served = 0
	for i in range(N):
		p = heapq.heappop(people)
		if p >= time:
			time += p
			served += 1
	return served
res = CF545D()
print(res)


input()
arr = [int(i) for i in input().split()]
arr.sort()
ans = t = 0
for i in arr:
	if i >= t:
		ans += 1
		t += i
print(ans)


import sys
n = int(input())
a = list(map(int, input().split()))
a.sort()
waiting_time = 0
served_cust = 0
for serving_time in a:
	if waiting_time <= serving_time:
		served_cust += 1
		waiting_time += serving_time
print(served_cust)


c = 0
t = 0
n = input()
l = list(map(int, input().split()))
l.sort()
for i in l:
	if t <= i:
		c += 1
		t += i
print(c)


import sys, math
input = sys.stdin.readline
t = 1
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	c = 0
	q = 0
	for i in range(n):
		if c <= a[i]:
			q = q + 1
			c = c + a[i]
	print(q)


n = int(input())
lista = list(map(int, input().split()))
lista.sort()
time = 0
atn = 0
for i in lista:
	if time <= i:
		atn += 1
		time += i
	else:
		continue
print(atn)


def serve(arr, w):
	for i in range(len(arr)):
		if arr[i] >= w:
			x = arr.pop(i)
			return x
	return 0
n = int(input())
a = list(map(int, input().split(' ')))
a.sort()
result = 0
waited = 0
t = serve(a, waited)
while t > 0:
	result += 1
	waited += t
	t = serve(a, waited)
print(result)


n = int(input())
L = list(map(int, input().split()))
L.sort()
r = 0
t = 0
for i in range(n):
	if L[i] >= t:
		r += 1
		t += L[i]
print(r)


input()
(cnt, ans) = (0, 0)
mat = sorted(map(int, input().split()))
for i in mat:
	if cnt <= i:
		ans += 1
		cnt += i
print(ans)


n = int(input())
queue = list(map(int, input().split()))
queue.sort()
time = 0
numberServed = 0
for i in range(n):
	if time <= queue[i]:
		time += queue[i]
		numberServed += 1
print(numberServed)


a = int(input())
x = [int(x) for x in input().split()]
x.sort()
time = 0
c = 0
for i in range(a):
	if x[i] >= time:
		time += x[i]
		c += 1
print(c)


n = int(input())
p = [i for i in map(int, input().split())]
p.sort()
i = 1
ans = 1
sum = p[0]
while i < n:
	if p[i] >= sum:
		ans += 1
		sum += p[i]
	i += 1
print(ans)


(n, q) = (0, [])
with open(0) as f:
	n = int(f.readline())
	q = list(map(int, f.readline().split()))
q.sort()
(num, time) = (0, 0)
for i in range(n):
	if q[i] >= time:
		num += 1
		time += q[i]
print(num)


n = int(input())
ts = list(map(int, input().split()))

def solve(n, ts):
	ts.sort()
	cum = 0
	sat = 0
	for t in ts:
		if cum <= t:
			sat += 1
			cum += t
	return sat
print(solve(n, ts))


size = int(input())
mylist = list(map(int, input().split()))
mylist.sort()
currentSum = 0
count = 0
for value in mylist:
	if currentSum <= value:
		count += 1
		currentSum += value
print(count)


n = int(input())
fila = list(map(int, input().split()))
fila.sort()
waitingtime = 0
ok = n
for pessoa in fila:
	if waitingtime > pessoa:
		ok -= 1
	else:
		waitingtime += pessoa
print(ok)


n = int(input())
l = list(map(int, input().split()))
l.sort()
s = 0
c = 0
for i in range(n):
	if s <= l[i]:
		c += 1
		s += l[i]
print(c)


import sys
n = int(sys.stdin.readline())
inp = sys.stdin.readline()[:-1].split(' ')
t = [int(num) for num in inp]
t.sort()
sumT = 0
ans = 0
for tn in t:
	if sumT <= tn:
		ans = ans + 1
		sumT = sumT + tn
print(ans)


input()
a = b = 0
c = sorted(list(map(int, input().split())))
for i in c:
	if a <= i:
		a += i
		b += 1
print(b)


n = input()
a = sorted(map(int, input().split()))
(ans, time) = (0, 0)
for ii in a:
	if ii >= time:
		ans += 1
		time += ii
print(ans)


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math

def bin1(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = k ** mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin1(mid + 1, r, k, t, b, val, ans)
		else:
			return bin1(l, mid - 1, k, t, b, val, ans)

def bin2(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = t * k ** mid + b * mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin2(l, mid - 1, k, t, b, val, ans)
		else:
			return bin2(mid + 1, r, k, t, b, val, ans)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def bin(l, r, ll, val):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		if val >= ll[mid][0] and val <= ll[mid][1]:
			return mid
		elif val < ll[mid][0]:
			return bin(l, mid - 1, ll, val)
		else:
			return bin(mid + 1, r, ll, val)

def deci(n):
	s = ''
	while n != 0:
		if n % 2 == 0:
			n = n // 2
			s = '0' + s
		else:
			n = n // 2
			s = '1' + s
	return s

def diff(s1, s2):
	if len(s1) < len(s2):
		v = len(s1)
		while v != len(s2):
			s1 = '0' + s1
			v = v + 1
	else:
		v = len(s2)
		while v != len(s1):
			s2 = '0' + s2
			v = v + 1
	c = 0
	for i in range(len(s1)):
		if s1[i:i + 1] != s2[i:i + 1]:
			c = c + 1
	return c
from sys import stdin, stdout

def fac(a, b):
	v = a
	while a != b:
		v *= a - 1
		a = a - 1
	return v

def bino(l, r, n):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		val1 = math.log(n / mid + 1, 2)
		val2 = int(val1)
		if val1 == val2:
			return val1
		elif val1 < 1.0:
			return bino(l, mid - 1, n)
		else:
			return bino(mid + 1, r, n)

def binary(l, r, ll, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		if ll[mid] >= val:
			ans = ll[mid]
			return binary(l, mid - 1, ll, val, ans)
		else:
			return binary(mid + 1, r, ll, val, ans)
n = int(input())
l = list(map(int, input().split(' ')))
l.sort()
if n == 1:
	print(1)
else:
	c = 0
	count = 0
	ind = 0
	l1 = []
	while ind < n:
		if l[ind] > c:
			c += l[ind]
			count += 1
			ind += 1
		else:
			break
	while True:
		val = binary(ind, n - 1, l, c, -1)
		if val == -1:
			break
		else:
			count += 1
			c += val
	print(count)


n = int(input())
ar = list(sorted(list(map(int, input().split()))))
curr = 0
sum1 = 0
for i in range(n):
	if curr <= ar[i]:
		sum1 += 1
		curr += ar[i]
print(sum1)


n = int(input())
li = list(map(int, input().split()))
sum = 0
res = 0
li.sort()
for i in li:
	if i >= sum:
		res += 1
		sum += i
print(res)


n = int(input())
t = [int(i) for i in input().split()]
t.sort()
a = [int(i) for i in t]
b = []
for i in range(1, len(t)):
	if t[i - 1] <= a[i]:
		b.append(a[i])
		t[i] += t[i - 1]
	else:
		t[i] = t[i - 1]
p = len(b)
print(p + 1)


def solve(a):
	start = 0
	c = 0
	for i in a:
		if start <= i:
			c += 1
			start += i
	print(c)
	return
n = int(input())
a = sorted([int(i) for i in input().split()])
solve(a)


n = int(input())
l = sorted(list(map(int, input().split())))
ans = 0
t = 0
for i in l:
	if i >= t:
		ans += 1
		t += i
print(ans)


asd = input()
myinput = input().split(' ')
myinput2 = [int(i) for i in myinput]
myinput2.sort()
temp = 0
x = 0
happies = 0
while x < len(myinput2):
	if temp <= myinput2[x]:
		temp = temp + myinput2[x]
		happies = happies + 1
	x = x + 1
print(happies)


n = int(input())
a = sorted(list(map(int, input().split())))
(m, c) = (0, 0)
for i in a:
	if i >= m:
		c += 1
		m += i
print(c)


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
time = 0
cnt = 0
for i in l:
	if time <= i:
		time += i
		cnt += 1
print(cnt)


n = int(input())
a = sorted(list(map(int, input().split())))
(c, s) = (0, 0)
for i in range(n):
	if s <= a[i]:
		c += s <= a[i]
		s += a[i]
print(c)


n = int(input())
c = 0
d = 0
for i in sorted(map(int, input().split())):
	if c <= i:
		c += i
		d += 1
print(d)


def parser():
	while 1:
		data = list(input().split(' '))
		for number in data:
			if len(number) > 0:
				yield number
input_parser = parser()

def get_word():
	global input_parser
	return next(input_parser)

def get_number():
	data = get_word()
	try:
		return int(data)
	except ValueError:
		return float(data)
n = get_number()
persons = []
for i in range(n):
	persons.append(get_number())
persons.sort()
sum = 0
happy = 0
for i in range(n):
	if persons[i] >= sum:
		happy += 1
		sum += persons[i]
	i += 1
print(happy)


import math
import os
import random
import re
import sys
import functools
from operator import itemgetter, attrgetter
n = int(input())
s = list(map(int, input().strip().split()))
swap = sorted(s)
(r, t) = (0, 0)
for i in range(n):
	if swap[i] >= t:
		r += 1
		t += swap[i]
print(r)


from sys import stdin
n = int(stdin.readline())
nt = list(map(int, stdin.readline().split()))
nt.sort()
sum = 0
res = 0
for i in nt:
	if i >= sum:
		res += 1
		sum += i
print(res)


n = int(input())
l = sorted(map(int, input().split()))
k = 0
ans = 0
for x in l:
	if x >= k:
		ans += 1
		k += x
print(ans)


n = int(input())
A = sorted(list(map(int, input().split())))
sum = 0
count = 0
for i in range(0, n):
	if A[i] >= sum:
		count += 1
		sum += A[i]
print(count)


n = int(input())
s = list(map(int, input().split()))
b = sorted(s)
(time, num) = (0, 0)
t = 0
while b:
	t = b.pop(0)
	if t >= time:
		num += 1
		time += t
print(num)


n = int(input())
list_in = input().split()
for i in range(n):
	list_in[i] = int(list_in[i])
list_in = sorted(list_in)
m = 0
sprt = 0
best = 1
sprt += list_in[0] - best
list_in.pop(0)
m += 1
while list_in != []:
	if list_in[0] >= best + sprt:
		sprt += list_in[0] - best
		list_in.pop(0)
		best = best * 2
		m += 1
	else:
		list_in.pop(0)
print(m)


n = int(input())
queue = list(map(int, input().strip().split()))
swapped = sorted(queue)
minutes = 0
satisfied = 1
for i in range(n):
	if i > 0:
		minutes = minutes + swapped[i - 1]
		if minutes <= swapped[i]:
			satisfied += 1
		else:
			swapped[i] = 0
print(satisfied)


n = int(input())
arr = input().split(' ')
for i in range(n):
	arr[i] = int(arr[i])
arr.sort()
ans = 0
time = 0
for i in arr:
	if time <= i:
		ans += 1
		time += i
print(ans)


(n, s, x) = (int(input()), 0, 0)
A = list(map(int, input().split()))
A.sort()
for i in range(n):
	if A[i] >= s:
		x += 1
		s += A[i]
print(x)


n = int(input())
lst1 = input().split()
lst2 = []
for i in lst1:
	lst2.append(int(i))
lst2.sort()
Count = 1
Sum = lst2[0]
for i in range(1, n):
	if lst2[i] >= Sum:
		Sum += lst2[i]
		Count += 1
print(Count)


n = int(input())
queue = list(map(int, input().split()))
queue = sorted(queue)
satisfiedPeople = 0
time = 0
for i in queue:
	if time <= i:
		satisfiedPeople += 1
		time += i
print(satisfiedPeople)


input()
t = list(map(int, input().split()))

def solve(t):
	t.sort()
	c = s = 0
	for i in t:
		if i >= s:
			c += 1
			s += i
	return c
print(solve(t))


from sys import stdin
max_val = int(10000000000000.0)
min_val = int(-10000000000000.0)

def read_int():
	return int(stdin.readline())

def read_ints():
	return [int(x) for x in stdin.readline().split()]

def read_str():
	return input()

def read_strs():
	return [x for x in stdin.readline().split()]
lens = read_int()
queue = sorted(read_ints())
curr = 0
for i in queue:
	if curr > i:
		lens -= 1
	else:
		curr += i
print(lens)


from bisect import bisect_left

def main():
	input()
	l = sorted(map(int, input().split()))
	tot = res = i = 0
	try:
		while True:
			tot += l[i]
			res += 1
			i = bisect_left(l, tot, lo=i + 1)
	except IndexError:
		print(res)
main()


n = int(input())
queue = input().split()
for i in range(n):
	queue[i] = int(queue[i])
queue.sort()
sumE = queue[0]
ind = 1
while ind <= len(queue) - 1:
	if queue[ind] < sumE:
		del queue[ind]
	else:
		sumE += queue[ind]
		ind += 1
print(len(queue))


n = int(input())
A = list(map(int, input().split()))
A.sort()
time = 0
ans = 0
for i in A:
	if i >= time:
		ans += 1
		time += i
print(ans)


n = int(input())
people = list(map(int, input().split()))
people.sort()
happy = 0
time = 0
for person in people:
	if time <= person:
		time += person
		happy += 1
print(happy)


n = int(input())
l = list(map(int, input().split()))
l.sort()
dis = 0
i = total = 0
while i < n:
	if l[i] >= total:
		total += l[i]
		i += 1
	else:
		dis += 1
		i += 1
print(n - dis)


n = int(input())
a = sorted((int(i) for i in input().split()))
lst = []
sum = 0
for i in range(n):
	if a[i] >= sum:
		lst.append(a[i])
		sum += a[i]
print(len(lst))


import sys
lines = []
for Line in sys.stdin:
	lines.append(Line.rstrip('\n'))
n = int(lines[0])
del lines[0]
t = sorted(list(map(int, lines[0].split())))
a = t[0]
r = 0
i = 1
while i < n:
	if t[i] < a:
		i += 1
		r += 1
	else:
		a += t[i]
		i += 1
print(len(t) - r)


num = int(input())
timelist = [int(x) for x in input().split()]
timelist.sort()
totaltime = 0
for elem in timelist:
	if elem >= totaltime:
		totaltime += elem
	else:
		num -= 1
print(num)


n = int(input())
l = [int(x) for x in str(input()).split(' ')]
l.sort()
sum = 0
cnt = 0
for i in range(n):
	if sum <= l[i]:
		cnt = cnt + 1
		sum = sum + l[i]
print(cnt)


import math, string, itertools, fractions, heapq, collections, re, array, bisect
from itertools import chain, dropwhile, permutations, combinations
from collections import defaultdict

def main(n, s):
	s.sort()
	curr = 0
	ans = 0
	for x in s:
		if x >= curr:
			ans += 1
			curr += x
	print(ans)

def main_input(info=0):
	n = int(input())
	t = list(map(int, input().split()))
	main(n, t)
main_input()


n = int(input())
a = list(map(int, input().split()))
a.sort()
ct = 1
s = a[0]
for i in range(1, n):
	if a[i] >= s:
		s += a[i]
		ct += 1
print(ct)


input()
t = list(map(int, input().split()))
t.sort()
(s, r) = (0, 0)
for i in t:
	if s <= i:
		s += i
		r += 1
print(r)


n = int(input())
t = [int(x) for x in input().split()]
wait_time = 0
satisfied = 0
for ti in sorted(t):
	if wait_time <= ti:
		satisfied += 1
		wait_time += ti
print(satisfied)


from math import ceil, sqrt, gcd, log, floor
from collections import deque

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())

def msi():
	return map(str, input().strip().split(' '))

def lsi():
	return list(msi())
n = ii()
a = li()
a.sort()
c = 1
s = a[0]
for i in range(1, n):
	if a[i] >= s:
		c += 1
		s += a[i]
print(c)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
wait = ans = 0
for i in arr:
	if i >= wait:
		ans += 1
		wait += i
print(ans)


lenght = int(input())
wqueue = [int(x) for x in input().split()]
time = 0
undis = 0
wqueue.sort()
for person in wqueue:
	if time <= person:
		undis += 1
		time += person
print(undis)


n = int(input())
lst = [int(i) for i in input().split()]
lst.sort()
cur_sum = lst[0]
count = 1
for i in range(1, len(lst)):
	if lst[i] >= cur_sum:
		count += 1
		cur_sum += lst[i]
print(count)


n = int(input())
xs = sorted(map(int, input().split()))
r = 0
t = 0
for x in xs:
	if t <= x:
		r += 1
		t += x
print(r)


n = int(input())
f = list(map(int, input().split()))
f.sort()
t = 0
answer = 0
for i in range(n):
	if t <= f[i]:
		answer += 1
		t += f[i]
print(answer)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def can(m, s):
	return 0 <= s <= 9 * m
n = inp()
t = list(invr())
t.sort()
m = 0
s = 0
for i in range(n):
	if s <= t[i]:
		s += t[i]
		m += 1
print(m)


import math
m = int(input())
a = list(map(int, input().split()))
a.sort()
sum = 0
s = 0
for i in range(m):
	if sum <= a[i]:
		sum += a[i]
		s += 1
		i += 1
	else:
		i += 1
print(s)


list3 = int(input().strip())
list1 = sorted(map(int, input().split()))
sum = 0
answer = 0
for i in list1:
	if sum <= i:
		answer += 1
		sum += i
print(answer)


n = int(input())
c = list(sorted(map(int, input().split())))
r = 0
v = 0
i = 0
while i < n:
	if v <= c[i]:
		r += 1
		v += c[i]
		i += 1
	else:
		while i < n and v > c[i]:
			i += 1
print(r)


n = int(input())
li = [int(x) for x in input().split()]
li.sort()
s = 0
out = []
for i in range(n):
	if s <= li[i]:
		s += li[i]
		out.append(li[i])
print(len(out))


n = int(input())
string = input().split(' ')
list = []
for i in string:
	list.append(int(i))
list.sort()
count = 0
time = 0
for i in range(len(list)):
	if list[i] >= time:
		count += 1
		time = time + list[i]
print(count)


n = int(input())
arr = [int(x) for x in input().split()]
arr.sort()
total = 0
ans = 0
for i in range(n):
	if total <= arr[i]:
		ans += 1
		total += arr[i]
print(ans)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
su = 0
cnt = 0
for i in range(n):
	if arr[i] >= su:
		cnt += 1
		su += arr[i]
print(cnt)


from math import *
from collections import deque
from copy import deepcopy
import sys

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def multi():
	return map(int, input().split())

def strmulti():
	return map(str, inp().split())

def lis():
	return list(map(int, inp().split()))

def lcm(a, b):
	return a * b // gcd(a, b)

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def stringlis():
	return list(map(str, inp().split()))

def out(var):
	sys.stdout.write(str(var))

def printlist(a):
	print(' '.join((str(a[i]) for i in range(len(a)))))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
n = int(input())
a = lis()
a.sort()
sum = 0
ans = 0
for i in a:
	if i >= sum:
		ans += 1
		sum += i
print(ans)


(n, l1) = (int(input()), list(map(int, input().split())))
l1.sort()
(count1, count2) = (0, 0)
for i in range(0, n):
	if count1 <= l1[i]:
		count2 += 1
		count1 += l1[i]
print(count2)


n = int(input())
t = list(map(int, input().split()))
count = 1
t.sort()
Sum = t[0]
for i in range(1, n):
	if Sum <= t[i]:
		count += 1
		Sum += t[i]
print(count)


from sys import stdin, stdout

def INI():
	return int(stdin.readline())

def INL():
	return [int(_) for _ in stdin.readline().split()]

def INS():
	return stdin.readline()

def MOD():
	return pow(10, 9) + 7

def OPS(ans):
	stdout.write(str(ans) + '\n')

def OPL(ans):
	[stdout.write(str(_) + ' ') for _ in ans]
	stdout.write('\n')
n = INI()
A = sorted(INL())
ans = 1
s = A[0]
for _ in range(1, n):
	if A[_] >= s:
		ans += 1
		s += A[_]
OPS(ans)


num = int(input())
my_list = list(map(int, input().split()))
my_list.sort()
a = 0
c = 0
for i in my_list:
	if a <= i:
		a += i
		c += 1
print(c)


n = int(input())
l = list(map(int, input().split()))
l.sort()
cnt = 0
w = 0
for i in range(n):
	if w <= l[i]:
		cnt += 1
		w += l[i]
print(cnt)


n = int(input())
a = list(map(int, input().split()))
a.sort()
served = 0
ans = 0
for x in a:
	if served <= x:
		ans += 1
		served += x
print(ans)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
x = 0
count = 0
for i in a:
	if x <= i:
		count += 1
		x += i
print(count)


__author__ = 'Sandi'
import sys
import heapq
lines = sys.stdin.read().strip().split('\n')
n = int(lines[0])
customers = lines[1].split(' ')
customers = list(map(int, customers))
heap = customers[:]
heapq.heapify(heap)
cumSum = 0
ok = 0
while len(heap) > 0:
	val = heapq.heappop(heap)
	if cumSum <= val:
		ok += 1
		cumSum += val
print(ok)


N = int(input())
X = sorted(list(map(int, input().split())))
(Sum, Cnt) = (0, 0)
for i in X:
	if i >= Sum:
		Cnt += 1
		Sum += i
print(Cnt)


input()
s2 = input()
arr = s2.split(' ')
arr2 = []
for i in range(0, len(arr)):
	arr2.append(int(arr[i]))
arr2.sort()
num = 0
hp = 0
for j in range(0, len(arr2)):
	if num <= arr2[j]:
		hp = hp + 1
		num += arr2[j]
print(hp)


n = int(input())

def qsort(L):
	if len(L) <= 1:
		return L
	return qsort([lt for lt in L[1:] if lt < L[0]]) + [L[0]] + qsort([ge for ge in L[1:] if ge >= L[0]])

def sub_sort(array, low, high):
	key = array[low]
	while low < high:
		while low < high and array[high] >= key:
			high -= 1
		while low < high and array[high] < key:
			array[low] = array[high]
			low += 1
			array[high] = array[low]
	array[low] = key
	return low

def quick_sort(array, low, high):
	if low < high:
		key_index = sub_sort(array, low, high)
		quick_sort(array, low, key_index)
		quick_sort(array, key_index + 1, high)
s = input()
s1 = s.split()
a = n * [0]
for i in range(n):
	a[i] = int(s1[i])
a = sorted(a)
sum = 0
num = 0
for i in range(n):
	if sum <= a[i]:
		num += 1
		sum += a[i]
print(num)


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
c = 0
t = 0
for i in range(n):
	if a[i] >= t:
		c += 1
		t += a[i]
print(c)


n = int(input())
t = list(map(int, input().split()))
ans = 1
t.sort()
s = t[0]
i = 1
while i < n:
	if s <= t[i]:
		ans += 1
		s += t[i]
	else:
		while i < n and s > t[i]:
			i += 1
		if i < n and s <= t[i]:
			ans += 1
			s += t[i]
	i += 1
print(ans)


def nSatisfiedPeople(people_sWaitTimes):
	people_sWaitTimes.sort()
	(answer, totalWaitTime) = (0, 0)
	for waitTime in people_sWaitTimes:
		if totalWaitTime <= waitTime:
			answer += 1
			totalWaitTime += waitTime
	return answer
nPeople = input()
print(nSatisfiedPeople(list(map(int, input().split(' ')))))


n = int(input())
l = map(int, input().split())
s = sorted(l)
waitTime = 0
res = 0
for (i, v) in enumerate(s):
	if waitTime <= v:
		res += 1
		waitTime += v
print(res)


n = int(input())
l = list(map(int, input().split(' ')))[:n]
l.sort()
count = 0
s = []
s.append(l[0])
for i in l[1:]:
	if sum(s) <= i:
		s.append(i)
count = len(s)
print(count)


n = int(input())
a = [int(i) for i in input().split(' ')]
tot = s = 0
for (ind, i) in enumerate(sorted(a)):
	if s > i:
		tot += 1
	else:
		s += i
print(n - tot)


a = int(input())
A = input().split()
for i in range(a):
	A[i] = int(A[i])
A.sort()
answer = 0
per = 0
for i in range(a):
	if A[i] - per >= 0:
		answer += 1
		per += A[i]
print(answer)


n = int(input())
t = list(map(int, input().split()))
t.sort()
s = 0
n = 0
for x in t:
	if x >= s:
		s += x
		n += 1
print(n)


n = int(input())
sp = sorted(list(map(int, input().split())))
count = 0
s = 0
for i in sp:
	if i >= s:
		count += 1
		s += i
print(count)


(s, p) = (0, 0)
input()
for i in sorted(map(int, input().split())):
	if i >= p:
		p += i
		s += 1
print(s)


n = input()
inp = [int(x) for x in input().split()]
inp.sort()
count = 0
time = 0
for i in inp:
	if time <= i:
		time += i
		count += 1
print(count)


def arr_inp():
	return [int(x) for x in stdin.readline().split()]
from sys import *
(n, a) = (int(input()), sorted(arr_inp()))
(sum, ans) = (a[0], 1)
for i in a[1:]:
	if i >= sum:
		ans += 1
	else:
		continue
	sum += i
print(ans)


n = int(input())
time = [int(i) for i in input().split()]
time.sort()
tem = 0
people = 0
for i in range(len(time)):
	if time[i] >= tem:
		people += 1
		tem += time[i]
	else:
		continue
print(people)


n = int(input())
l = list(map(int, input().split()))
l.sort()
time = 0
count = 0
for i in range(n):
	if l[i] >= time:
		count = count + 1
		time = time + l[i]
print(count)


n = int(input())
l = [int(i) for i in input().split()]
l.sort()
sum = 0
c = 0
for i in range(n):
	if l[i] >= sum:
		c += 1
		sum += l[i]
print(c)


n = int(input())
t = [int(j) for j in input().split()]
sum = 0
c = 0
t.sort()
for i in range(n):
	if sum <= t[i]:
		c += 1
		sum += t[i]
print(c)


def f(l, key):
	l = l - 1
	r = len(arr)
	while l + 1 < r:
		m = (l + r) // 2
		if arr[m] >= key:
			r = m
		else:
			l = m
	return r
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
s = 0
c = 0
i = 0
while i < n:
	if arr[i] >= s:
		s += arr[i]
		i += 1
		c += 1
	else:
		i = f(i, s)
print(c)


n = int(input())
queue = [int(i) for i in input().split()]
queue.sort()
acum = queue[0]
res = n
for i in range(1, n):
	if acum > queue[i]:
		res -= 1
	else:
		acum += queue[i]
print(res)


is_debug = False
n = int(input())
t = sorted(list(map(int, input().split())))
v = 1
c = 0
for i in range(n):
	if i == 0 and 1 <= t[i]:
		c += 1
		v = t[i]
	elif v <= t[i]:
		print(f'v={v}, t[i]={t[i]}') if is_debug else ''
		c += 1
		v += t[i]
print(f'{c}')


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
c = 1
s = a[0]
i = 1
while i < n:
	if s <= a[i]:
		c += 1
		s += a[i]
	i += 1
print(c)


n = int(input())
queue = [int(x) for x in input().split(' ')]
queue.sort()
wait = 0
notdisappointed = 0
for i in range(len(queue)):
	if queue[i] >= wait:
		notdisappointed += 1
		wait += queue[i]
print(notdisappointed)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
time = arr[0]
count = 1
i = 1
while i < n:
	flag = 0
	while i < n and time <= arr[i]:
		flag = 1
		count += 1
		time += arr[i]
		i += 1
	if flag == 0:
		i += 1
print(count)


n = int(input())
a = input().split()
for i in range(n):
	a[i] = int(a[i])
a.sort()
s = 0
k = 0
for i in a:
	if i >= s:
		k += 1
		s = s + i
print(k)


n = int(input())
l = list(map(int, input().split()))
l.sort()
prefixsum = [0]
sum = 0
for i in range(n - 1):
	sum += l[i]
	prefixsum.append(sum)
kush = 0
sub = 0
for i in range(n):
	if l[i] >= prefixsum[i] - sub:
		kush += 1
	else:
		sub += l[i]
print(kush)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	a = sorted(LI())
	t = 0
	r = 0
	for c in a:
		if c >= t:
			r += 1
			t += c
	return r
print(main())


import time
n = int(input(''))
t = list(map(int, input().split()))
tim = time.time()
t.sort(reverse=False)
sm = 0
answer = 0
i = 0
while i < n:
	if t[i] >= sm:
		answer += 1
	while t[i] < sm and i != n - 1:
		i += 1
		if t[i] >= sm:
			answer += 1
			break
	sm += t[i]
	i += 1
print(answer)


import os
import sys
from math import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return map(int, input().split())

def array():
	return [int(i) for i in input().split()]
n = int(input())
a = sorted(array())
c = 1
t = a[0]
for i in range(1, n):
	if a[i] >= t:
		c += 1
		t += a[i]
print(c)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans

def sieve_of_eratosthenes(n):
	ans = []
	arr = [1] * (n + 1)
	(arr[0], arr[1], i) = (0, 0, 2)
	while i * i <= n:
		if arr[i] == 1:
			j = i + i
			while j <= n:
				arr[j] = 0
				j += i
		i += 1
	for k in range(n):
		if arr[k] == 1:
			ans.append(k)
	return ans

def nc2(x):
	if x == 1:
		return 0
	else:
		return x * (x - 1) // 2
for _ in range(1):
	n = int(input())
	serve = list(map(int, input().split()))
	serve.sort()
	(cnt, temp) = (0, 0)
	for i in range(n):
		if temp <= serve[i]:
			cnt += 1
			temp += serve[i]
	print(cnt)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
num = 0
res = 0
for i in range(n):
	if int(a[i]) >= num:
		res += 1
		num += int(a[i])
print(res)


n = int(input())
c = 0
s = 0
for i in sorted(map(int, input().split())):
	if s > i:
		continue
	s += i
	c += 1
print(c)


import sys
inp = [int(x) for x in sys.stdin.buffer.read().split()]
ii = 0
out = []
for t in range(1):
	n = inp[ii]
	ii += 1
	A = inp[ii:ii + n]
	ii += n
	A.sort()
	count = 0
	prev = 0
	while A:
		a = A.pop(0)
		if a >= prev:
			prev += a
			count += 1
	out.append(count)
print('\n'.join((str(x) for x in out)))


input()
la = list(map(int, input().split()))
la.sort()
tt = 0
c = 0
i = 0
while i < len(la):
	if la[i] >= tt:
		c += 1
		tt += la[i]
	i += 1
print(c)


a = int(input())
b = [int(x) for x in input().split()]
b.sort()
time = 0
count = 0
for x in b:
	if x >= time:
		count += 1
		time += x
print(count)


from fileinput import *
for line in input():
	if lineno() == 1:
		[n] = list(map(int, line.split()))
	else:
		data = list(map(int, line.split()))
data.sort()
time = [0] * n
cumsum = 0
count = 0
for i in range(1, n):
	cumsum = cumsum + data[i - 1]
	if cumsum > data[i]:
		time[i] = data[i]
		data[i] = 0
	else:
		time[i] = cumsum
print(n - data.count(0))


t = int(input())
A = list(map(int, input().split()))
s = 0
ans = 0
x = 0
A.sort()
while x < t:
	if s <= A[x]:
		ans += 1
		s += A[x]
	x += 1
print(ans)


N = int(input())
time = sorted(map(int, input().split()))
ans = 0
tsum = 0
for t in time:
	if tsum <= t:
		ans += 1
		tsum += t
print(ans)


n = int(input())
a = list(map(int, input().split()))
a.sort()
c = 1
cs = a[0]
for i in range(1, n):
	if cs <= a[i]:
		c += 1
		cs += a[i]
print(c)


n = int(input())
times = list(map(int, input().split()))
times.sort()
su = 0
count = 0
for i in times:
	if su <= i:
		count += 1
		su += i
print(count)


from sys import stdin
n = int(input())
z = list(map(int, stdin.readline().rstrip().split(' ')))
z.sort()
t = 0
c = 0
for i in range(n):
	if z[i] >= t:
		c += 1
		t += z[i]
print(c)


n = int(input())
s = list(map(int, input().split()))
s.sort()
sum = 0
c = 0
for i in s:
	if i >= sum:
		c += 1
		sum += i
print(c)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
ans = 0
pr = 0
for i in range(n):
	if pr <= arr[i]:
		ans += 1
		pr += arr[i]
print(ans)


def read():
	inputs = input().strip()
	return list(map(int, inputs.split()))

def read_pair():
	return map(int, input().split(' '))
n = int(input())
a = read()
a = sorted(a)
sum = 0
happy = 0
for i in range(n):
	if a[i] >= sum:
		sum += a[i]
		happy += 1
print(happy)


import sys, math
input = sys.stdin.readline

def inp():
	n = int(input())
	return n

def inlt():
	a = list(map(int, input().split()))
	return a

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	(a, b) = map(int, input().split())
	return (a, b)
t = 1
for i in range(t):
	n = inp()
	a = inlt()
	a.sort()
	c = 0
	q = 0
	for i in range(n):
		if c <= a[i]:
			q = q + 1
			c = c + a[i]
	print(q)


n = int(input())
a = [int(s) for s in input().split()]
a.sort()
ans = 0
tot = 0
for i in range(n):
	if a[i] >= tot:
		tot += a[i]
		ans += 1
print(ans)


n = input()
(cnt, sumo) = (0, 0)
t = list(map(int, input().split()))
for x in sorted(t):
	if sumo <= x:
		sumo += x
		cnt += 1
print(cnt)


from itertools import accumulate
n = int(input())
arr = list(map(int, input().split()))
arr = sorted(arr)
ans = 0
summ = arr[0]
for i in range(1, n):
	if summ > arr[i]:
		ans += 1
	else:
		summ += arr[i]
print(n - ans)


def queue(n, t):
	t.sort()
	m = 0
	s = 0
	for i in range(n):
		if t[i] >= s:
			m += 1
			s += t[i]
	return m
n = int(input())
t = list(map(int, input().split()))
print(queue(n, t))


n = int(input())
a = sorted(list(map(int, input().split())))
diss = 0
wait = 0
for i in range(n):
	if wait <= a[i]:
		wait += a[i]
	else:
		diss += 1
print(n - diss)


def contar_personas_no_decepcionadas(largo_cola, cola):
	contar = 0
	espera_total = 0
	cola.sort(reverse=True)
	for persona in range(largo_cola):
		tiempo_atencion = cola.pop()
		if espera_total <= tiempo_atencion:
			contar += 1
			espera_total += tiempo_atencion
	return contar
print(contar_personas_no_decepcionadas(int(input()), list(map(lambda x: int(x), input().split(' ')))))


n = int(input())
A = [int(i) for i in input().split()]
A.sort()
num = 0
sum = 0
for i in range(n):
	if sum <= A[i]:
		num += 1
		sum += A[i]
print(num)


n = int(input())
items = [int(item) for item in input().split(' ')]
items_copy = items.copy()
list.sort(items_copy)
num = 0
_sum = 0
for i in range(0, n):
	if _sum <= items_copy[i]:
		_sum += items_copy[i]
		num += 1
print(num)


n = int(input())
t = [int(a) for a in input().split()]
t.sort()
sumTilnow = 0
count = 0
for i in range(n):
	if sumTilnow <= t[i]:
		count += 1
		sumTilnow += t[i]
print(count)


from collections import Counter
n = int(input())
a = [int(s) for s in input().split()]
c = set(a)
d = Counter(a)
res = 0
summ = 0
for i in sorted(list(c)):
	for j in range(d[i]):
		if summ <= i:
			res += 1
			summ += i
		else:
			break
print(res)


import math
from decimal import *
n = int(input())
nos = sorted(list(map(int, input().split())))
tot = 0
ans = 0
for i in range(n):
	if tot <= nos[i]:
		tot += nos[i]
		ans += 1
print(ans)


n = int(input())
k = 0
k1 = 0
kr = 0
l = list(map(int, input().split()))
l = sorted(l)
p = 0
for i in range(n):
	if k <= l[i]:
		k1 = k1 + 1
		k = k + l[i]
print(k1)


n = int(input())
t = list(map(int, input().split()))
t.sort()
pre = [t[0]]
ans = 1
for i in range(1, n):
	if pre[-1] <= t[i]:
		ans += 1
		pre.append(pre[-1] + t[i])
print(ans)


n = int(input())
person = [int(i) for i in input().split()]
person.sort(reverse=True)
ans = []
time = 0
for i in range(n):
	if person[-1] >= time:
		t = person.pop()
		ans.append(t)
		time += t
	else:
		person.pop()
print(len(ans))


n = int(input())
a = list(map(int, input().split()))
a.sort()
res = 0
c = 0
for e in range(n):
	if a[e] >= res:
		res += a[e]
		c += 1
print(c)


z = 1
n = int(input())
a = list(map(int, input().split()))
a.sort()
sum = a[0]
for i in range(1, n):
	if a[i] >= sum:
		z = z + 1
		sum = sum + a[i]
print(z)


n = int(input())
d = sorted(list(map(int, input().split())))
ts = 0
th = 0
for i in d:
	if i >= ts:
		th += 1
		ts += i
print(th)


from itertools import accumulate
n = int(input())
t = list(map(int, input().split()))
t.sort()
pft = list(accumulate(t))
dp = 0
s = 0
for i in range(1, n):
	if t[i] < pft[i - 1]:
		dp += 1
		s += t[i]
	pft[i] -= s
print(n - dp)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
s = 0
ans = 0
for val in arr:
	if val >= s:
		ans += 1
		s += val
print(ans)


from heapq import heapify, heappop
n = input()
a = list(map(int, input().split()))
heapify(a)
sum = 0
count = 0
while a:
	next = a[0]
	if sum <= next:
		sum += next
		count += 1
	heappop(a)
print(count)


n = int(input())
t = list(map(int, input().split()))
n = len(t)
t.sort()
ans = 1
s = t[0]
for i in range(1, n):
	if s <= t[i]:
		ans += 1
		s += t[i]
print(ans)


def main():
	input()
	tot = res = 0
	for t in sorted(map(int, input().split())):
		if t >= tot:
			res += 1
			tot += t
	print(res)
main()


n = input()
a = input().split()
for i in range(len(a)):
	a[i] = int(a[i])
a.sort()
ans = time = 0
for i in a:
	if time <= i:
		ans += 1
		time += i
print(ans)


from sys import stdin

def solve():
	n = int(input())
	A = [int(i) for i in stdin.readline().split()]
	A.sort()
	c = 0
	ans = 0
	for i in A:
		if i >= c:
			ans += 1
			c += i
	return ans
print(solve())


n = int(input())
a = [int(c) for c in input().split()]
a = sorted(a)
total = 1
totalWaiting = a[0]
for i in range(n):
	if i != 0:
		if a[i] >= totalWaiting:
			total += 1
			totalWaiting += a[i]
print(total)


def nDisappointedPeople(people_sWaitTimes):
	people_sWaitTimes.sort()
	(answer, totalWaitTime) = (0, 0)
	for waitTime in people_sWaitTimes:
		if totalWaitTime > waitTime:
			answer += 1
		else:
			totalWaitTime += waitTime
	return answer
print(int(input()) - nDisappointedPeople(list(map(int, input().split(' ')))))


import sys
import math
import collections

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()
for t in range(1):
	n = int(input())
	arr = get_list()
	arr.sort()
	count = 0
	prev = 0
	i = 0
	while i < n:
		a = arr[i]
		if a >= prev:
			prev += a
			count += 1
		i += 1
	print(count)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
sm = a[0]
c = 1
i = 1
while i < n:
	if a[i] >= sm:
		sm += a[i]
		i += 1
		c += 1
	else:
		while i < n and a[i] < sm:
			i += 1
		if i == n:
			break
		else:
			sm += a[i]
			c += 1
print(c)


n = int(input())
num = map(int, input().split())
count = 0
adding = 0
a = list(num)
a.sort()
for i in a:
	if i >= adding:
		count += 1
		adding += i
print(count)


n = int(input())
queue = sorted(list(map(int, input().split())))
plus = queue[0]
answer = 1
for i in queue[1:]:
	if i >= plus:
		plus += i
		answer += 1
print(answer)


N = int(input())
A = list(map(int, input().strip().split()))
A.sort()
h = 0
t = 0
for k in range(0, N):
	if A[k] >= t:
		t = t + A[k]
		h = h + 1
print(h)


x = int(input())
(*li,) = map(int, input().split())
li.sort()
(cnt, ans) = (0, 0)
for i in range(x):
	if cnt <= li[i]:
		ans += 1
		cnt += li[i]
print(ans)


n = int(input())
l = [int(i) for i in input().split()]
l.sort()
s = 0
k = 0
for i in range(n):
	if i == 0 or s <= l[i]:
		k += 1
		s += l[i]
print(k)


k = z = int(input())
x = sorted(map(int, input().split()))
s = 0
for i in range(z):
	if x[i] < s:
		k -= 1
	else:
		s += x[i]
print(k)


n = int(input().strip())
arr = list(map(int, input().strip().split()))
arr.sort()
dis = 0
s = 0
for i in arr:
	if s > i:
		dis += 1
	else:
		s += i
print(n - dis)


a = int(input())
b = list(map(int, input().split()))
b.sort()
sum = 0
c = 1
sum = b[0]
for i in range(1, a):
	if b[i] >= sum:
		sum = sum + b[i]
		c = c + 1
print(c)


def answer(n, t):
	t.sort()
	wait_time = 0
	happy_people = 0
	for i in range(n):
		if t[i] >= wait_time:
			happy_people += 1
			wait_time += t[i]
	return happy_people

def main():
	n = int(input())
	t = [int(i) for i in input().split()]
	print(answer(n, t))
	return
main()


n = int(input())
s = sorted([int(i) for i in input().split()])
d = []
l = 1
a = len(s)
b = s[0]
while l < a:
	if s[l] < b:
		d.append(s.pop(l))
		a -= 1
	else:
		b += s[l]
		l += 1
print(len(s))


input()
q = list(map(int, input().split()))
q.sort()
ans = 0
add = 0
for a in q:
	if add <= a:
		ans += 1
		add += a
print(ans)


n = int(input())
t = [int(x) for x in input().split()]
t.sort()
p = 1
s = t[0]
for i in range(1, n):
	if s <= t[i]:
		p += 1
		s += t[i]
print(p)


def bin_search(x, left, right, num_list):
	if right - left <= 1:
		if x > num_list[right]:
			return -1
		elif x <= num_list[left]:
			return left
		else:
			return right
	else:
		middle = (right + left) // 2
		if x > num_list[middle]:
			return bin_search(x, middle + 1, right, num_list)
		elif x < num_list[middle]:
			return bin_search(x, left, middle, num_list)
		else:
			return middle
n = int(input())
serving_time = sorted(list(map(int, input().split())))
i = 1
cur_time = serving_time[0]
happiness = 1
while i < n:
	if serving_time[i] >= cur_time:
		cur_time += serving_time[i]
		happiness += 1
		i += 1
	else:
		i = bin_search(cur_time, i, n - 1, serving_time)
		if i != -1:
			cur_time += serving_time[i]
			happiness += 1
		else:
			i = n
print(happiness)


a = int(input())
k = sorted(list(map(int, input().split())))
r = k[0]
d = 0
for i in range(1, a):
	if k[i] >= r:
		r += k[i]
	else:
		d += 1
print(a - d)


n = int(input())
L = sorted(map(int, input().split()))
r = 0
w = 0
for v in L:
	if w <= v:
		w += v
		r += 1
print(r)


n = int(input())
x = [int(i) for i in input().split()]
x = sorted(x)
m = 0
s = 0
for i in x:
	if s <= i:
		m += 1
		s += i
print(m)


n = int(input())
T = [int(t) for t in input().split()]
T.sort()
curr = 0
dis = 0
B = []
for i in range(n):
	if T[i] - curr < 0:
		B.append(T[i])
	else:
		curr += T[i]
for b in B:
	if b - curr < 0:
		dis += 1
print(n - dis)


def main():
	n = int(input())
	time = list(map(int, input().split()))
	time.sort()
	curr = 0
	i = 0
	while i < n:
		if time[i] >= curr:
			curr += time[i]
			i += 1
		else:
			time.pop(i)
			n -= 1
	print(i)
main()


n = int(input())
a = list(map(int, input().split()))
(r, x) = (0, 0)
for i in a:
	if i >= r:
		x + 1
	r += i
a.sort()
(r, q) = (0, 0)
for i in a:
	if i >= r:
		q += 1
		r += i
print(q - x)


n = int(input())
lst = list(map(int, input().split()))
x = 0
a = 0
lst.sort()
for i in lst:
	if i >= x:
		a += 1
		x += i
print(a)


import os
import sys
from io import BytesIO, IOBase

def solution(arr, n):
	arr.sort()
	(res, time) = (1, arr[0])
	for i in range(1, n):
		if arr[i] >= time:
			time += arr[i]
			res += 1
	write(res)

def main():
	n = r_int()
	arr = r_array()
	solution(arr, n)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, sep=' ', end='\n'):
	for x in args[:-1]:
		sys.stdout.write(str(x) + sep)
	sys.stdout.write(str(args[-1]) + end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


n = int(input())
x = list(map(int, input().split()))
if n < 3:
	print(n)
elif n == 3:
	x.sort()
	if x[0] + x[1] > x[2]:
		print(2)
	else:
		print(3)
else:
	y = []
	y.append(min(x))
	x.remove(min(x))
	y.append(min(x))
	x.remove(min(x))
	s = sum(y)
	x.sort()
	while max(x) >= sum(y):
		for i in range(len(x)):
			if s <= x[i]:
				y.append(x[i])
				x.remove(x[i])
				s = sum(y)
				break
		if len(x) == 0:
			break
	print(len(y))


n = int(input())
L = sorted(list(map(int, input().split())))
w = 0
d = 0
for i in range(n):
	if w <= L[i]:
		w += L[i]
	else:
		d += 1
		continue
print(n - d)


n = int(input())
line = list(map(int, input().split()))
line.sort()
time = 0
result = 0
for i in range(n):
	if time <= line[i]:
		result += 1
		time += line[i]
print(result)


def main():
	n = int(input())
	ip = [int(item) for item in input().split(' ')]
	ip.sort()
	cnt = 1
	sum_ip = ip[0]
	for i in range(1, len(ip)):
		if ip[i] >= sum_ip:
			cnt += 1
			sum_ip += ip[i]
	print(cnt)
main()


n = int(input())
t = list(map(int, input().split()))
t.sort()
new_t = []
sum = 0
end = []
for i in range(n):
	if sum <= t[i]:
		new_t.append(t[i])
		sum += t[i]
	else:
		end.append(t[i])
t = new_t + end
sum = 0
res = 0
for i in range(len(t)):
	if sum <= t[i]:
		res += 1
	sum += t[i]
print(res)


n = int(input())
sl = list(map(int, input().strip().split()))
sl.sort()
sum1 = 0
cnt = 0
for i in range(0, n):
	if sum1 <= sl[i]:
		cnt += 1
		sum1 += sl[i]
print(cnt)


n = int(input())
times = [int(time) for time in input().split()]
times.sort()
past = 0
ok = 0
for i in range(n):
	if past <= times[i]:
		ok += 1
		past += times[i]
print(ok)


import os.path
from math import gcd, floor, ceil
from collections import *
import sys
mod = 1000000007
INF = float('inf')

def st():
	return list(sys.stdin.readline().strip())

def li():
	return list(map(int, sys.stdin.readline().split()))

def mp():
	return map(int, sys.stdin.readline().split())

def inp():
	return int(sys.stdin.readline())

def pr(n):
	return sys.stdout.write(str(n) + '\n')

def prl(n):
	return sys.stdout.write(str(n) + ' ')
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
n = inp()
l = sorted(li())
cur = 0
ans = 0
for i in l:
	if cur <= i:
		ans += 1
		cur += i
pr(ans)


n = int(input())
therow = input().split()
therow = [int(i) for i in therow]
therow.sort()
answer = 0
waittimetohere = 0
for i in therow:
	if waittimetohere <= i:
		answer = answer + 1
		waittimetohere = waittimetohere + i
print(answer)


n = int(input())
list1 = []
a = input().split(' ')
list2 = []
for i in range(n):
	list2.append(int(a[i]))
list2.sort()
sum1 = list2[0]
count = 1
for i in range(1, n):
	if sum1 <= list2[i]:
		count += 1
		sum1 += list2[i]
print(count)


n = int(input())
arr = sorted(list(map(int, input().split())))
(ps, count) = (0, 0)
for i in arr:
	if ps <= i:
		count += 1
		ps += i
print(count)


n = int(input())
l = list(map(int, input().split()))
sum = 0
res = 0
l.sort()
for i in range(n):
	if l[i] >= sum:
		res += 1
	else:
		l[i] = 0
	sum = sum + l[i]
print(res)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
arrn = [0] * (n + 1)
count = 0
i = 0
edit = 0
while i < n + edit:
	if arr[i] >= arrn[i - 1]:
		arrn[i] = arrn[i - 1] + arr[i]
		count += 1
		i += 1
	else:
		del arr[i]
		edit -= 1
print(count)


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
count = 0
wait = l[0]
for i in range(1, n):
	if wait > l[i]:
		count += 1
	else:
		wait = wait + l[i]
print(n - count)


from bisect import *
n = int(input())
l = [*map(int, input().split())]
l.sort()
cnt = 0
j = 1
arr = [l[0]]
while j < n:
	while j < n and arr[-1] > l[j]:
		j += 1
	else:
		if j < n:
			arr.append(arr[-1] + l[j])
			j += 1
print(len(arr))


n = input()
people = list(input().strip().split(' '))
people = list(map(int, people))
people.sort()
_sum = 0
result = 0
for person in people:
	if person >= _sum:
		result = result + 1
		_sum = _sum + person
print(result)


from sys import stdin, stdout
cin = stdin.readline
cout = stdout.write
mp = lambda : list(map(int, cin().split()))

def chars():
	s = cin()
	return list(s[:len(s) - 1])

def pl(a):
	for val in a:
		cout(val + '\n')
(n,) = mp()
t = sorted(mp())
time = ans = 0
for val in t:
	if time <= val:
		ans += 1
		time += val
cout(str(ans))


def min_above(L, n, treshold):
	min_pos = 0
	for i in range(n):
		if L[i] < L[min_pos] and L[i] >= treshold or (L[i] >= treshold and L[min_pos] < treshold):
			min_pos = i
	if min_pos == 0 and L[min_pos] < treshold:
		return None
	return min_pos

def swap(L, i1, i2):
	temp = L[i1]
	L[i1] = L[i2]
	L[i2] = temp
	return L
n = eval(input())
l = n
queue = [int(i) for i in input().split()]
wait_time = 0
happy = 0
min_pos = 0
for i in range(n):
	min_pos = min_above(queue[i:], l, wait_time)
	if min_pos is None:
		break
	min_pos += i
	l -= 1
	happy += 1
	wait_time += queue[min_pos]
	queue = swap(queue, i, min_pos)
print(happy)


n = int(input())
ti_sort = list(sorted(map(int, input().split())))
count = 1
total = 0
for i in range(1, len(ti_sort)):
	total += ti_sort[i - 1]
	if ti_sort[i] < total:
		ti_sort[i] = 0
	else:
		count += 1
print(count)


n = int(input())
a = [int(x) for x in input().split()]
w = 0
s = 0
for i in sorted(a):
	if w <= i:
		s += 1
		w += i
print(s)


N = int(input())
A = [int(x) for x in input().split()]
A.sort()
(cnt, s) = (1, A[0])
for i in range(1, N):
	if A[i] >= s:
		cnt += 1
		s += A[i]
print(cnt)


n = int(input())
a = list(sorted(map(int, input().split())))
s = [a[0]]
for i in range(1, n):
	s.append(s[i - 1] + a[i])
ans = 1
h = 0
for i in range(1, n):
	if a[i] >= s[i - 1] - h:
		ans += 1
	else:
		h += a[i]
print(ans)


n = int(input())
a = map(int, input().split())
s = ans = 0
for i in sorted(a):
	if i >= s:
		ans += 1
		s += i
print(ans)


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
count = 0
i = 0
sum = 0
while i < n:
	if count <= a[i]:
		sum = sum + 1
		count = count + a[i]
	i = i + 1
print(sum)


n = int(input())
serveTime = [int(x) for x in input().split()]
serveTime.sort()
answer = 0
curSum = 0
for i in range(len(serveTime)):
	if serveTime[i] >= curSum:
		curSum += serveTime[i]
		answer += 1
print(answer)


import os
import sys
from io import BytesIO, IOBase
mod = 10 ** 9 + 7

def main():
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	z = 0
	ans = 0
	for item in l:
		if item >= z:
			ans += 1
			z += item
	print(ans)

def nouse0():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse1():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse2():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def nouse3():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse4():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse5():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
main()


n = int(input())
c = [int(x) for x in input().split()]
c.sort()
s = 0
k = 0
for i in c:
	if s <= i:
		k += 1
		s += i
print(k)


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
pref = l[:]
for i in range(1, n):
	pref[i] += pref[i - 1]
ans = 1
ind = 1
total = l[0]
while ind < n:
	if l[ind] >= total:
		total += l[ind]
		ans += 1
	ind += 1
print(ans)


import sys
n = int(input())
t = sorted(list(map(int, sys.stdin.readline().split())))
tmp = 0
ans = 0
for ti in t:
	if ti >= tmp:
		ans += 1
		tmp += ti
print(ans)


s1 = input()
s2 = [int(i) for i in input().split()]
s2.sort()
k = 0
n = 0
for i in s2:
	if i >= k:
		n += 1
		k += i
print(n)


from collections import Counter, defaultdict
from sys import stdin, stdout
input = stdin.readline
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
n = I()
a = LI()
a.sort()
d = 0
c = 0
for i in range(n):
	if d <= a[i]:
		c += 1
		d += a[i]
print(c)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log, pi, sin
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
n = int(data())
arr = l()
arr.sort()
time = 0
answer = 0
for i in range(n):
	if time > arr[i]:
		continue
	answer += 1
	time += arr[i]
out(answer)


import sys, os
from collections import Counter
import heapq
import math
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import os.path
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def listt():
	return [int(i) for i in input().split()]
t = 1
for _ in range(t):
	n = int(input())
	l = listt()
	l.sort()
	time = 0
	i = 0
	ans = 0
	while i < len(l):
		if time <= l[i]:
			ans += 1
			time += l[i]
		i += 1
	print(ans)


numOfPeople = int(input())
waitTimes = list(map(int, input().split()))

def numOfSatisfied(arr):
	arr.sort()
	dissapointed = 0
	suml = 0
	for i in range(1, len(arr)):
		if suml <= arr[i - 1]:
			suml += arr[i - 1]
		bigger = max(suml, arr[i])
		if arr[i] != bigger:
			dissapointed += 1
	ans = len(arr) - dissapointed
	return ans
print(numOfSatisfied(waitTimes))


n = int(input())
a = input().strip().split()
for (index, item) in enumerate(a):
	a[index] = int(item)
a.sort()
s = a[0]
m = 1
for i in range(1, n):
	if a[i] >= s:
		s += a[i]
		m += 1
print(m)


n = int(input())
l = list(map(int, input().split()))
l.sort()
summ = 0
ans = 0
for i in range(len(l)):
	if l[i] >= summ:
		ans += 1
		summ += l[i]
	else:
		continue
print(ans)


n = int(input())
t = [int(x) for x in input().split()]
t.sort()
now = 0
ans = 0
for x in t:
	if now <= x:
		now += x
		ans += 1
print(ans)


n = int(input())
l = list(map(int, input().split()))
l.sort()
t = 1
s = l[0]
i = 1
while i < len(l):
	if l[i] >= s:
		t += 1
		s += l[i]
	else:
		del l[i]
		i -= 1
	i += 1
print(t)


n = int(input())
a = list(map(int, input().split()))
jam = 0
counter = 0
a.sort()
for i in range(0, n):
	if a[i] >= jam:
		counter += 1
		jam += a[i]
print(counter)


(_, t) = (input(), sorted((int(x) for x in input().split())))
(s, h) = (0, 0)
for i in range(len(t)):
	if s <= t[i]:
		h += 1
		s += t[i]
print(h)


n = int(input())
t = [int(i) for i in input().split()]
t.sort()
temp = 0
cnt = 0
for i in t:
	if temp <= i:
		cnt += 1
		temp += i
print(cnt)


n = int(input())
b = list(map(int, input().split()))
b = sorted(b)
w = 0
x = 0
for i in range(n):
	if w <= b[i]:
		x = x + 1
		w = w + b[i]
print(x)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
prev = arr[0]
ans = 0
for i in arr[1:]:
	if i >= prev:
		ans += 1
		prev += i
	else:
		continue
print(ans + 1)


n = int(input())
lis = [0] + sorted(map(int, input().split()))
ans = 0
aa = []
cou = 0
for i in range(1, n + 1):
	if lis[i] >= cou:
		ans += 1
		cou += lis[i]
print(ans)


import os
import sys
from io import BytesIO, IOBase

def main():
	n = int(input())
	a = list(map(int, input().split(' ')))
	a.sort()
	cursum = a[0]
	ans = 1
	for x in range(1, n):
		if a[x] >= cursum:
			cursum += a[x]
			ans += 1
	print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
wait = 0
ans = 0
for i in range(n):
	if l[i] >= wait:
		wait += l[i]
		ans += 1
print(ans)


n = int(input())
t = [int(i) for i in input().split()]
t.sort()
wait = 0
ans = 0
for i in range(n):
	if t[i] >= wait:
		wait += t[i]
		ans += 1
print(ans)


t = int(input())
a = [int(i) for i in input().split()]
c = 0
s = 0
for i in sorted(a):
	if s <= i:
		c += 1
		s += i
print(c)


n = int(input())
t = [int(x) for x in input().split()]
t.sort()
wyn = 0
time = 0
for i in t:
	if i >= time:
		wyn += 1
		time += i
print(wyn)


input()
w = sorted([int(x) for x in input().split()])
tot = 0
good = 0
for i in range(len(w)):
	if tot <= w[i]:
		good += 1
		tot += w[i]
print(good)


input()
(s, v) = (0, 0)
for a in sorted(map(int, input().split())):
	if s <= a:
		v += 1
		s += a
print(v)


t = int(input())
q = list(map(int, input().split()))
q.sort()
add = 0
notDissapointed = 0
for x in q:
	if add <= x:
		notDissapointed += 1
		add += x
print(notDissapointed)


def queue(t, a):
	a.sort()
	s = 0
	ans = 0
	for i in range(t):
		if a[i] >= s:
			s += a[i]
			ans += 1
	return ans
t = int(input())
a = list(map(int, input().split(' ')))
print(queue(t, a))


from sys import stdin

def input():
	return stdin.readline()
n = int(input())
t = list(map(int, input().split()))
t.sort()
ans = 0
total = 0
for (i, ti) in enumerate(t):
	if ti >= total:
		ans += 1
		total += ti
print(ans)


input()
line = input()
array = line.split(' ')
array2 = []
for i in range(0, len(array)):
	array2.append(int(array[i]))
array2.sort()
total = int(0)
disapointed = 0
for j in range(0, len(array2)):
	if total <= array2[j]:
		disapointed += 1
		total += array2[j]
print(disapointed)


n = int(input())
t = sorted(list(map(int, input().split())))
s = 0
k = 0
for i in range(n):
	if t[i] < s:
		k += 1
	else:
		s += t[i]
print(n - k)


a = int(input())
b = sorted(map(int, input().split()))
s = 0
n = 0
for i in range(a):
	if s <= b[i]:
		s += b[i]
		n += 1
print(n)


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
c = 0
h = 0
l1 = []
for x in l:
	if x >= c:
		h += 1
		c += x
		l1.append(x)
	else:
		x = x
print(h)


n = int(input())
l = sorted([int(x) for x in input().split()])

def solve(l):
	tot = 0
	m = max(l)
	r = 0
	mv = 0
	while tot <= m and mv < len(l):
		v = find(l, tot, mv, len(l) - 1)
		tot += l[v]
		r += 1
		mv = v + 1
	return r

def find(l, x, i, j):
	if i == j:
		return i
	if i == j - 1:
		if l[i] >= x:
			return i
		else:
			return j
	m = (i + j) // 2
	if l[m] >= x:
		return find(l, x, i, m)
	else:
		return find(l, x, m + 1, j)
print(solve(l))


n = int(input())
laiki = sorted(list(map(int, input().split())))
neneapmierinatie = 0
tekosais = 0
for laiks in laiki:
	if laiks >= tekosais:
		tekosais += laiks
		neneapmierinatie += 1
print(neneapmierinatie)


n = int(input())
a = sorted(map(int, input().split()))
(r, q) = (0, 0)
for i in a:
	if i >= r:
		q += 1
		r += i
print(q)


n = int(input())
t = list(map(int, input().split()))
t.sort()
wait = 0
rs = 0
for time in t:
	if wait <= time:
		rs += 1
		wait += time
print(rs)


n = int(input())
l = [int(x) for x in input().split(' ')]
l.sort()
tim = 0
ans = 0
for i in range(n):
	if not tim > l[i]:
		ans += 1
		tim += l[i]
print(ans)


n = int(input())
a = list(map(int, input().split(' ')))
a.sort()
(sums, k) = (0, 0)
for i in range(n):
	if sums <= a[i]:
		k += 1
		sums += a[i]
print(k)


n = int(input())
list1 = list(map(int, input().split()))
list1.sort()
sum1 = 0
c = 0
for i in range(0, n):
	if sum1 <= list1[i]:
		sum1 = sum1 + list1[i]
		c = c + 1
print(c)


import functools
import heapq as hp
import collections
import bisect
import math

def unpack(func=int):
	return map(func, input().split())

def l_unpack(func=int):
	return list(map(func, input().split()))

def s_unpack(func=int, rev=False):
	return sorted(map(func, input().split()), reverse=rev)

def ml_unpack(n):
	return [int(input()) for i in range(n)]

def range_n():
	return range(int(input()))

def getint():
	return int(input())

def counter(a):
	d = {}
	for x in a:
		if x in d:
			d[x] += 1
		else:
			d[x] = 1
	return d

def main():
	n = getint()
	a = s_unpack()
	ans = cum = 0
	for i in range(n):
		if a[i] >= cum:
			ans += 1
			cum += a[i]
	print(ans)
main()


n = int(input())
sum = 0
u = list(map(int, input().split()))
u.sort()
sum = u[0]
p = 1
for i in range(1, n):
	if sum <= u[i]:
		sum += u[i]
		p += 1
	else:
		continue
print(p)


n = int(input())
t = list(sorted(map(int, input().split())))
time = 0
ans = 0
i = 0
for i in range(n):
	if time <= t[i]:
		ans += 1
		time += t[i]
print(ans)


n = int(input())
a = list(map(int, input().split()))
a.sort()
(m, y) = (0, 0)
for i in range(n):
	if a[y] < m:
		del a[y]
	else:
		m += a[y]
		y += 1
print(len(a))


n = int(input())
x = sorted(list(map(int, input().split())))
wait_time = x[0]
ans = n
for i in range(1, n):
	if wait_time > x[i]:
		ans -= 1
		continue
	wait_time += x[i]
print(ans)


N = int(input())
nums = list(map(int, input().split()))
nums.sort()
temp = 0
count = 0
for i in nums:
	if temp <= i:
		temp += i
		count += 1
print(count)


n = int(input())
l = [int(i) for i in input().split()]
l.sort()
l1 = []
k = 1
sum == 0
while k < len(l):
	if sum(l[:k]) > l[k]:
		l.pop(k)
	else:
		k += 1
print(k)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
line = 0
sum = 0
for a in arr:
	if a >= sum:
		sum += a
		line += 1
print(line)


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
n = int(input())
arr = get_array()
arr.sort()
c = 1
s = arr[0]
for i in range(1, n):
	if s <= arr[i]:
		c += 1
		s = s + arr[i]
print(c)


q = int(input())
a = [int(x) for x in input().split()]
a.sort()
ans = 1
s = a[0]
i = 1
while i < q:
	if s <= a[i]:
		ans += 1
		s = s + a[i]
		i += 1
	else:
		i += 1
print(ans)


import sys
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
ans = 0
sum = 0
for x in arr:
	if x >= sum:
		sum += x
	else:
		ans += 1
print(n - ans)


n = int(input())
t = sorted([int(i) for i in input().split()])
ndis = 0
time = 0
for i in range(n):
	if t[i] >= time:
		ndis += 1
		time += t[i]
print(ndis)


input()
w = 0
sum = 0
for i in sorted(map(int, input().split())):
	if sum <= i:
		sum += i
		w += 1
print(w)


n = int(input())
t = sorted(map(int, input().split()))
cost = 0
count = 0
for i in range(n):
	if cost > t[i]:
		continue
	cost += t[i]
	count += 1
print(count)


n = int(input())
(count, s) = (0, 0)
times = list(map(int, input().split()))
times.sort()
for i in range(n):
	if s <= times[i]:
		count += 1
		s += times[i]
print(count)


n = int(input())
times = list(map(int, input().split()))
times = sorted(times)
count_not_happy = 0
j = 0
k = 0
for i in range(n):
	if times[i] >= j:
		j += times[i]
	else:
		count_not_happy += 1
print(n - count_not_happy)


trash = input()
queue = [int(x) for x in input().split()]
queue = sorted(queue)
disappointed = 0
waitTime = 0
for i in range(len(queue)):
	if waitTime > queue[i]:
		disappointed += 1
	else:
		waitTime += queue[i]
print(len(queue) - disappointed)


n = int(input())
list1 = sorted(list(map(int, input().split(' '))))
sum1 = 0
ct = 0
for i in list1:
	if sum1 <= i:
		sum1 += i
		ct += 1
print(ct)


n = int(input())
t = list(map(int, input().split()))
t.sort()
time = 0
happy = 0
for i in t:
	if time <= i:
		happy += 1
		time += i
print(happy)


input()
li = sorted(list(map(int, input().split())))[::-1]
s = 0
k = 0
while li:
	a = li.pop()
	if a >= s:
		k += 1
		s += a
print(k)


n = int(input())
per = list(map(int, input().split()))
wt = 0
ans = 0
per.sort()
for i in per:
	if i >= wt:
		wt += i
		ans += 1
print(ans)


x = int(input())
y = sorted(map(int, input().split()))
(a, b) = (0, 0)
for i in y:
	if a <= i:
		a += i
		b += 1
print(b)


input()
answer = 0
timeSum = 0
for i in sorted(map(int, input().split())):
	if timeSum <= i:
		timeSum += i
		answer += 1
print(answer)


from collections import Counter, defaultdict, deque
import heapq as hq
from itertools import count, islice
import math
import sys
input = sys.stdin.readline
n = int(input())
arr = [int(x) for x in input().split()]
arr.sort()
s = 0
res = 0
for i in range(n):
	if arr[i] >= s:
		res += 1
		s += arr[i]
print(res)


n = int(input())
t = sorted(map(int, input().split()))
(s, d) = (0, 0)
for x in range(n):
	if t[x] < s:
		d += 1
	else:
		s += t[x]
print(n - d)


number = int(input())
a_list = list(map(int, input().split()))
a_list.sort()
x = 0
y = 0
for i in a_list:
	if i >= x:
		y += 1
		x += i
print(y)


def suma(valor, lista):
	contador = 0
	for i in range(lista):
		contador += lista[i]
	if valor <= contador:
		return True
	else:
		return False
comp = [0]
n = int(input())
personas = list()
satis = 0
valores = list(map(int, input().strip().split()))
valores.sort()
tiempo = 0
for valor in valores:
	if valor >= tiempo:
		tiempo += valor
		satis += 1
	else:
		continue
print(satis)


n = int(input())
a = list(map(int, input().split()))
a.sort()
dup_list = list(a)
count = 1
temp_minus = 0
for i in range(1, len(a)):
	dup_list[i] = dup_list[i - 1] + dup_list[i]
for i in range(1, len(dup_list)):
	if a[i] >= dup_list[i - 1] - temp_minus:
		count += 1
	else:
		temp_minus += a[i]
print(count)


n = int(input())
s = input().split()
array = []
for i in range(0, n):
	array.append(int(s[i]))
array.sort()
sum = 0
c = 0
for i in range(0, n):
	if array[i] >= sum:
		c = c + 1
		sum += array[i]
print(c)


n = int(input())
l = list(map(int, input().split()))
l.sort()
total = 0
cnt = 0
for i in l:
	if total <= i:
		cnt += 1
		total += i
print(cnt)


n = int(input())
ints = input()
intsList = list(map(int, ints.split()))
intsList.sort()
newList = intsList.copy()
num = 0
summ = 0
for i in range(0, len(intsList)):
	newList[i] -= summ
	if newList[i] >= 0:
		summ += intsList[i]
		num += 1
print(num)


input()
happy = waiting_time = 0
for t in sorted(map(int, input().split())):
	if t >= waiting_time:
		(happy, waiting_time) = (happy + 1, waiting_time + t)
print(happy)


n = int(input())
T = sorted(list(map(int, input().split())))
total_time = 0
ans = 0
for i in range(n):
	if total_time <= T[i]:
		total_time += T[i]
		ans += 1
print(ans)


from collections import defaultdict, deque, Counter, OrderedDict
from heapq import heappop, heappush

def main():
	n = int(input())
	l = sorted([int(i) for i in input().split()])
	(wait, i, ans) = (0, 0, 0)
	while i < n:
		now = l[i]
		if wait > now:
			i += 1
		else:
			ans += 1
			wait += now
			i += 1
	print(ans)
main()


n = int(input())
(*m,) = map(int, input().split())
m.sort()
prear = []
prear.append(m[0])
count = 1
j = 1
i = 0
while j < n:
	if prear[i] <= m[j]:
		i += 1
		count += 1
		prear.append(prear[i - 1] + m[j])
	j += 1
print(count)


def main():
	from sys import stdin, stdout
	it = iter(map(int, stdin.read().split()))
	n = next(it)
	neededTime = []
	for _ in range(n):
		neededTime.append(next(it))
	neededTime.sort()
	cumTime = 0
	ans = 0
	i = 0
	while i < n:
		while i < n and neededTime[i] < cumTime:
			i += 1
		if i < n:
			ans += 1
			cumTime += neededTime[i]
			i += 1
	stdout.write(str(ans) + '\n')
main()


import bisect
import os
import gc
import sys
from io import BytesIO, IOBase
from collections import Counter
from collections import deque
import heapq
import math
import statistics

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	s = set()
	for p in range(2, n + 1):
		if prime[p]:
			s.add(p)
	return s

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def invert(x):
	if x == '1':
		return '0'
	else:
		return '1'

def main():
	n = iin()
	l = ain()
	l.sort()
	s = 0
	ans = 0
	for i in range(n):
		if s <= l[i]:
			ans += 1
			s += l[i]
	print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())
queue = list(map(int, input().split()))
queue.sort()
res = 0
total = 0
i = 0
while i < len(queue):
	if total <= queue[i]:
		res += 1
		total += queue[i]
	i += 1
print(res)


n = int(input())
a = list(map(int, input().split()))
a.sort()
count = 0
wt = a[0]
for i in range(1, n):
	if a[i] < wt:
		count += 1
	else:
		wt += a[i]
print(n - count)


import sys
n = int(input())
q = list(map(int, input().split(' ')))
q.sort()
s = q[0]
nd = 1
for i in range(1, n):
	if q[i] >= s:
		nd += 1
		s += q[i]
	else:
		q.append(q[i])
print(nd)


n = int(input())
a = sorted(list(map(int, input().split())))
ans = 0
b = []
sm = 0
for x in a:
	if x >= sm:
		b.append(x)
		sm += x
		ans += 1
print(ans)


n = int(input())
t = list(map(int, input().split()))
t.sort()
cnt = 0
currT = 0
for _t in t:
	if currT <= _t:
		cnt += 1
		currT += _t
print(cnt)


n = int(input())
queue = [int(x) for x in input().split()]
queue.sort()
wait = 0
nCount = 0
i = 0
while i <= n - 1:
	if queue[i] >= wait:
		nCount += 1
	else:
		queue[i] = 0
	wait += queue[i]
	i += 1
print(nCount)


import heapq
n = int(input())
a = [int(x) for x in input().split()]
a.sort()
sum = 0
c = 0
for i in range(n):
	if a[i] < sum:
		c += 1
	else:
		sum += a[i]
print(n - c)


def maxHappyPeople(arr):
	arr.sort()
	sum = arr[0]
	count = 1
	for i in range(1, len(arr)):
		if sum <= arr[i]:
			count += 1
			sum += arr[i]
	return count
n = int(input())
inputArray = input().strip().split()
arr = list()
for i in inputArray:
	arr.append(int(i))
print(maxHappyPeople(arr))


n = int(input())
time = [int(x) for x in input().split()]
time.sort()
record = []
sum = 0
for i in range(n):
	if time[i] >= sum:
		record.append(time[i])
		sum += time[i]
print(len(record))


input()
c = 0
t = 0
for i in sorted(map(int, input().split())):
	if t <= i:
		t += i
		c += 1
print(c)


n = int(input())
l_n = list(map(int, input().split()))
l_n.sort()
t = 0
n = 0
for t_n in l_n:
	if t <= t_n:
		t += t_n
		n += 1
print(n)


try:
	n = int(input())
	inp = input()
	queue = [int(x) for x in inp.split(' ')]
	if len(queue) > n:
		print('Invalid Input!\nNumber of elements must be at most', n)
	else:
		sum = 0
		count = 0
		queue.sort()
		for i in queue:
			if i >= sum:
				sum += i
				count += 1
		print(count)
except ValueError:
	print('Invalid Input')


n = int(input())
ns = sorted(map(int, str.split(input())))
happy = time = 0
for n in ns:
	if time <= n:
		time += n
		happy += 1
print(happy)


n = int(input())
t = [int(i) for i in input().split()]
t1 = sorted(t)
sum = 0
j = 0
for i in range(len(t)):
	if sum <= t1[i]:
		sum += t1[i]
		j += 1
print(j)


n = int(input())
w = [int(k) for k in input().split()]
w.sort()
res = 0
c = 0
for j in w:
	if j < c:
		res += 1
	else:
		c += j
print(n - res)


n = int(input())
l = [int(i) for i in input().split()]
l.sort()
(sum, res) = (0, 0)
for i in l:
	if sum <= i:
		res += 1
		sum += i
print(res)


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
num = int(z())
l = szzz()
ans = 0
k = 0
for i in range(num):
	if l[i] >= k:
		ans += 1
		k += l[i]
print(ans)


n = int(input())
people = list(map(int, input().split()))
people.sort()
counter = 0
wait_time = 0
for i in range(n):
	if wait_time <= people[i]:
		counter += 1
		wait_time += people[i]
print(counter)


import sys
import io
import os
total = 0
failed = 0

def debug(*args):
	if 'LOCALTEST' in os.environ:
		print(*args, file=sys.stderr)

def run(test, res):
	x = io.StringIO()
	with io.StringIO(test) as sys.stdin:
		with x as sys.stdout:
			work()
			z = x.getvalue().strip()
	sys.stdout = sys.__stdout__
	print('Passed?', z == res)
	print('Expected: ', res)
	print('Actual  : ', z)
	global total, failed
	total += 1
	failed += 1 if z != res else 0

def work():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	debug(a)
	c = 0
	s = 0
	for x in a:
		if x >= s:
			c += 1
			s += x
	print(c)

def test():
	run('5\n15 2 1 5 3', '4')
if 'LOCALTEST' in os.environ:
	test()
	print('\n Result: %s (%d total, %d failed)' % ('FAILED' if failed > 0 else 'PASSED', total, failed))
else:
	work()


n = int(input())
L = [int(x) for x in input().split()]
L.sort()
count = 0
s = 0
happy = 0
while count < n:
	if s <= L[count]:
		s += L[count]
		count += 1
		happy += 1
	else:
		count += 1
print(happy)


n = int(input())
d = [int(x) for x in input().split()]
d.sort()
s = 0
dis = 0
for i in d:
	if s > i:
		dis += 1
	else:
		s += i
print(n - dis)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
ans = arr[0]
res = [arr[0]]
for i in range(1, n):
	if ans <= arr[i]:
		ans += arr[i]
		res.append(arr[i])
print(len(res))


n = int(input().strip())
lst = list(map(int, input().strip().split()))
new_lst = sorted(lst)
ans = 0
k = 0
for (idx, value) in enumerate(lst):
	if new_lst[idx] >= k:
		ans += 1
		k += new_lst[idx]
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
cur = 0
res = 0
for x in a:
	if x >= cur:
		res += 1
		cur += x
print(res)


import math, sys
from collections import defaultdict, Counter, deque
INF = float('inf')

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def isPrime(n):
	if n <= 1:
		return False
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def primeFactors(n):
	factors = []
	i = 2
	while i ** 2 <= n:
		while n % i == 0:
			factors.append(i)
			n //= i
		i += 1
	if n > 1:
		factors.append(n)
	return factors

def vars():
	return map(int, input().split())

def array():
	return list(map(int, input().split()))

def c(n, r):
	return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))

def main():
	n = int(input())
	arr = array()
	arr.sort()
	w = 0
	cnt = 0
	for i in range(len(arr)):
		if w <= arr[i]:
			cnt += 1
			w += arr[i]
	print(cnt)
t = 1
for _ in range(t):
	main()


class problem(object):

	def __init__(self):
		pass

	def solve(self, n, X):
		X.sort()
		sum = 0
		ans = 0
		for i in range(n):
			if X[i] < sum:
				pass
			else:
				ans = ans + 1
				sum = sum + X[i]
		return ans
n = int(input())
X = [int(j) for j in input().split(' ')]
P = problem()
print(P.solve(n, X))


from sys import stdin
number = stdin.readline()
queue = sorted([int(time) for time in stdin.readline().strip('\n').split()])
satisfied_counter = 0
wait_time = 0
for serving_time in queue:
	if wait_time <= serving_time:
		satisfied_counter += 1
		wait_time += serving_time
print(satisfied_counter)


n = int(input())
a = list(map(int, input().split()))
a.sort()
cost = [0]
c = 0
i = 0
while i < n:
	if a[i] >= cost[-1]:
		cost.append(cost[-1] + a[i])
		c += 1
	i += 1
print(c)


n = int(input())
l = [int(i) for i in input().split()]
l.sort()
wait = 0
hpp = 0
for e in l:
	if e >= wait:
		wait += e
		hpp += 1
print(hpp)


input()
c = ans = 0
s = sorted(map(int, input().split()))
for i in s:
	if i >= c:
		ans += 1
		c += i
print(ans)


import sys
import bisect
input = sys.stdin.readline

def takeSecond(elem):
	return elem[1]
t = 1
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	(suma, ans) = (0, 0)
	for i in range(n):
		if suma <= l[i]:
			ans += 1
			suma += l[i]
	print(ans)


n = int(input())
a = sorted(map(int, input().split()))
w = a[0]
q = 1
for i in range(1, len(a)):
	if a[i] >= w:
		q += 1
		w += a[i]
print(q)


n = int(input())
t = [int(i) for i in input().split()]
t.sort()
wait_time = 0
total = 0
for i in range(n):
	if wait_time > t[i]:
		total += 1
	else:
		wait_time += t[i]
print(n - total)


def main():
	time = int(input())
	queue = input().split(' ')
	for i in range(len(queue)):
		queue[i] = int(queue[i])
	queue.sort()
	total = 0
	c = 0
	for x in queue:
		if total <= x:
			c += 1
			total += x
	return c
print(main())


n = int(input())
a = [int(n) for n in input().split(' ')]
a = sorted(a)
s = 0
k = 0
for i in range(len(a)):
	if a[i] >= s:
		k = k + 1
		s = s + a[i]
	else:
		a.append(a[i])
print(k)


a = int(input())
b = input()
b = b.split(' ')
b = map(int, b)
b = list(b)
b.sort()
t = 0
s = []
for i in range(len(b)):
	if sum(s) <= b[i]:
		t = t + 1
		s.append(b[i])
print(t)


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
sm = a[0]
i = 1
while i < len(a):
	while len(a) > i:
		if sm > a[i]:
			a.remove(a[i])
		else:
			break
	if len(a) > i:
		sm += a[i]
	i += 1
print(len(a))


n = int(input())
a = list(map(int, input().split()))
a.sort()
(summ, d) = (0, 0)
for i in range(n):
	if a[i] >= summ:
		d += 1
		summ += a[i]
print(d)


import sys
input = sys.stdin.readline
from math import *
n = int(input())
a = [int(x) for x in input().split()]
a.sort()
s = [a[0] for i in range(n)]
for i in range(1, n):
	s[i] = s[i - 1] + a[i]
c = 0
z = 0
for i in range(1, n):
	if a[i] < s[i - 1] - z:
		c += 1
		z += a[i]
print(n - c)


n = int(input())
line = [int(i) for i in input().split()]
line.sort()
ans = 1
i = 1
sum = line[0]
while i < len(line):
	if sum <= line[i]:
		sum = sum + line[i]
		ans = ans + 1
		i = i + 1
	else:
		del line[i]
		i = i
print(ans)


n = int(input())
nums = [int(i) for i in input().split()]
nums.sort()
p = 0
res = 1
flag = 0
p = nums[0]
nums.remove(nums[0])

def func(nums):
	global p, res, flag
	for i in nums:
		if p > i:
			continue
		elif p <= i:
			p += i
			res += 1
	print(res)
func(nums)


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
N = int(input())
A = [int(x) for x in input().split()]
A.sort()
ans = 0
total = 0
for (i, v) in enumerate(A):
	if total <= v:
		ans += 1
		total += v
print(ans)


__author__ = 'Utena'
n = int(input())
s = sorted(list(map(int, input().split())))
t = 0
sum = 0
for a in s:
	if a >= sum:
		t += 1
		sum += a
print(t)


input()
(o, t) = (0, 0)
l = sorted(list(map(int, input().split())))
for i in l:
	if i >= t:
		o += 1
		t += i
print(o)


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
n = ii()
l = sorted(il())
sm = l[0]
c = 1
for i in range(1, n):
	if sm <= l[i]:
		c += 1
		sm += l[i]
print(c)


n = int(input())
lst = list(map(int, input().split()))
counter = 0
summ = 0
lst = sorted(lst)
for i in range(len(lst)):
	if summ <= lst[i]:
		summ += lst[i]
		counter += 1
print(counter)


n = int(input())
l = sorted(list(map(int, input().split())))
ans = 0
p = 0
for i in range(n):
	if l[i] >= ans:
		p += 1
		ans += l[i]
print(p)


n = int(input())
line = [int(it) for it in str(input()).split()]
line.sort()
v = tar = 0
for i in range(n):
	if line[i] >= tar:
		v += 1
		tar += line[i]
print(v)


def solve(s):
	b = sorted(s)
	(time, num) = (0, 0)
	for i in range(n):
		if b[i] >= time:
			num += 1
			time += b[i]
	return num
n = int(input())
s = list(map(int, input().split()))
print(solve(s))


def lmap():
	return list(map(int, input().split()))
n = int(input())
w = lmap()
w.sort()
su = w[0]
hp = 1
for i in range(1, n):
	if w[i] >= su:
		hp += 1
		su += w[i]
print(hp)


n = int(input())
lst = list(map(int, input().rstrip().split()))
lst.sort()
summ = 0
count = 0
arr = []
for i in range(n):
	if lst[i] >= summ:
		summ += lst[i]
		count += 1
print(count)


import math
from collections import *
from heapq import *
n = int(input())
t = list((int(i) for i in input().split()))
t.sort()
s = 0
for i in t:
	if i < s:
		n -= 1
		continue
	s += i
print(n)


n = int(input())
a = list(map(int, input().split()))
a.sort()
t = 0
ksr = 0
tm = 0
for i in range(n):
	m = tm
	if m <= a[i]:
		t += 1
		tm += a[i]
	else:
		ksr += a[i]
print(t)


clientes = int(input())
tiempos = list(map(int, input().split()))
ordtime = sorted(tiempos)
dis = 0
suma = 0
for i in ordtime:
	if suma <= i:
		suma += i
		dis += 1
print(dis)


n = int(input())
L = sorted(list(map(int, input().split())))
(suma, cont) = (0, 0)
for k in L:
	if suma <= k:
		cont += 1
		suma += k
print(cont)


(n, m) = (input(), sorted(map(int, input().split())))
t = 0
h = 0
for i in m:
	if i >= t:
		t += i
		h += 1
print(h)


n = int(input())
arr = list(map(int, input().strip().split(' ')))
arr.sort()
cnt = 0
ans = 0
for i in arr:
	if i >= cnt:
		ans += 1
		cnt += i
print(ans)


N = int(input())
l = list(map(int, input().strip().split()))
l.sort()
w = 0
result = 0
for i in range(N):
	if l[i] >= w:
		result += 1
		w += l[i]
print(result)


input()
cur = cnt = 0
for i in sorted(map(int, input().split())):
	if cur <= i:
		cnt += 1
		cur += i
print(cnt)


n = int(input())
wl = [int(x) for x in input().split()]
wl.sort()
i = 1
c = 1
wt = wl[0]
while i < n:
	if wl[i] < wt:
		del wl[i]
		n -= 1
	else:
		c += 1
		wt += wl[i]
		i += 1
print(c)


n = int(input())
a = sorted(list(map(int, input().split())))
cnt = 0
s = 0
for i in range(n):
	if s <= a[i]:
		cnt += 1
		s += a[i]
print(cnt)


n = int(input())
lis = list(map(int, input().split()))
lis.sort()
cur = lis[0]
count = 1
i = 1
while i < n:
	if cur <= lis[i]:
		count += 1
	else:
		while i < n and cur > lis[i]:
			i += 1
		if i < n:
			count += 1
		else:
			break
	cur += lis[i]
	i += 1
print(count)


def maxundisappointed(n):
	n.sort()
	dis = 0
	s = 0
	for i in range(len(n)):
		if n[i] >= s:
			s += n[i]
			dis += 1
	return dis
input()
print(maxundisappointed(list(map(int, input().rstrip().split()))))


n = int(input())
l = sorted(list(map(int, input().split())))
x = 1
y = l[0]
for i in range(1, n):
	if l[i] >= y:
		x += 1
		y += l[i]
print(x)


x = int(input())
y = list(map(int, input().split(' ')))
y.sort()
s = 0
ct = 0
for i in range(x):
	if s <= y[i]:
		ct += 1
		s += y[i]
print(ct)


n = int(input())
t = list(map(int, input().split()))
t.sort()
s = 0
res = 0
for el in t:
	if s <= el:
		res += 1
		s += el
print(res)


n = input()
r = s = 0
for i in sorted(map(int, input().split())):
	if s <= i:
		s += i
		r += 1
print(r)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
ctr = 0
time = 0
for x in range(n):
	if a[x] < time:
		continue
	ctr += 1
	time += a[x]
print(ctr)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
k = a[0]
for i in range(1, len(a)):
	if a[i] - k < 0:
		a[i] = 0
	k += a[i]
l = 0
print(len(a) - a.count(0))


import math, sys, re, itertools
(rs, ri, rai) = (input, lambda : int(input()), lambda : list(map(int, input().split())))
n = ri()
t = rai()
t.sort()
res = 0
tt = 0
for i in range(n):
	if tt <= t[i]:
		res += 1
		tt += t[i]
print(res)


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
w = 0
c = 0
for i in l:
	if i >= w:
		c += 1
		w += i
print(c)


input()
l = sorted(list(map(int, input().split())))
t = 0
c = 0
for x in l:
	if t <= x:
		t += x
		c += 1
print(c)


n = int(input())
lt = [int(i) for i in input().split()]
lt.sort()
ans = 0
cnt = 0
for t in lt:
	if cnt > t:
		pass
	else:
		cnt += t
		ans += 1
print(ans)


n = int(input())
lst = list(map(int, input().split()))
lst.sort()
rs = 0
sum = 0
for i in lst:
	if sum <= i:
		rs += 1
		sum += i
print(rs)


n = int(input())
people = [int(i) for i in input().split()]
people.sort()
wait = 0
waited = 0
for wait_willingness in people:
	if wait <= wait_willingness:
		wait += wait_willingness
		waited += 1
print(waited)


n = int(input())
lis = [int(x) for x in input().split()]
lis.sort()
summ = lis[0]
count = 1
for i in range(1, n):
	if lis[i] >= summ:
		count += 1
		summ += lis[i]
	else:
		pass
print(count)


n = int(input())
t = list(map(int, input().split()))
t.sort()
ch = 0
i = 0
while i < len(t):
	if t[i] >= ch:
		ch += t[i]
		i += 1
	else:
		t.pop(i)
print(len(t))


n = int(input())
t = map(int, input().split())
t = sorted(t)
s = 0
l = 0
i = 0
while i < n:
	if t[i] >= s:
		s += t[i]
	else:
		l += 1
	i += 1
print(n - l)


def main():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	s = a.copy()
	ans = 0
	for i in range(1, len(a)):
		if a[i] < s[i - 1]:
			ans += 1
			s[i] = s[i - 1]
		else:
			s[i] = s[i - 1] + a[i]
	print(n - ans)
main()


size = int(input())
array = list(map(int, input().split()))
array = sorted(array)
currentSum = array[0]
counter = 0
for i in range(1, size):
	if array[i] >= currentSum:
		currentSum += array[i]
		counter += 1
print(counter + 1)


i_osob = int(input())
osoby = [int(x) for x in input().split()]
osoby.sort()
(czas, happy) = (0, 0)
for x in osoby:
	if czas <= x:
		happy += 1
		czas += x
print(happy)


n = int(input())
l = list(map(int, input().split()))
summ = 0
count = 0
l.sort()
for i in l:
	if summ <= i:
		count += 1
		summ += i
print(count)


n = int(input())
a = [int(k) for k in input().split()]
a.sort()
kolvo = 0
summa = 0
for i in range(n):
	if a[i] >= summa:
		summa += a[i]
		kolvo += 1
print(kolvo)


n = int(input())
x = input().split(' ')
tunggu = 0
senang = 0
y = []
for i in range(0, n):
	y.append(int(x[i]))
y.sort()
for i in range(len(y)):
	if int(y[i]) >= tunggu:
		senang += 1
		tunggu += int(y[i])
print(senang)


n = int(input())
time = [int(x) for x in input().split()]
time.sort()
count = 1
wait = time[0]
for i in range(1, n):
	if time[i] >= wait:
		count += 1
		wait += time[i]
print(count)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
total = 0
ok = 0
for i in range(len(a)):
	if a[i] >= total:
		ok += 1
		total += a[i]
print(ok)


n = int(input())
l = input().split(' ')
i = 0
for i in range(0, n):
	l[i] = int(l[i])
l.sort()
total = 0
dis = 0
for i in range(0, n):
	if l[i] < total:
		dis = dis + 1
	else:
		total = total + l[i]
print(n - dis)


n = int(input())
a = list(map(int, input().split()))
a.sort()
p = 0
di = 0
for i in range(n):
	if p <= a[i]:
		p += a[i]
		di += 1
print(di)


def main():
	n = int(input())
	s = input()
	a = list(map(int, s.split()))
	a.sort()
	(ans, sum) = (0, 0)
	for c in a:
		if sum <= c:
			ans += 1
			sum += c
	print(ans)
main()


from sys import stdin

def input():
	return stdin.readline()
n = int(input())
t = [int(i) for i in input().split()]
t.sort()
cnt = 0
s = 0
for i in t:
	if s <= i:
		cnt += 1
		s += i
print(cnt)


from sys import stdin, stdout
input = stdin.readline
ans = int(input())
q = sorted(list(map(int, input().split())))
t = 0
for i in q:
	if i < t:
		ans -= 1
	else:
		t += i
stdout.write(str(ans))


n = int(input())
a = input()
l1 = []
l = a.split(' ')
for i in l:
	l1.append(int(i))
l2 = [0] * (n + 1)
l1.sort()
count = 0
for i in range(len(l1)):
	if l2[i] <= l1[i]:
		l2[i + 1] = l2[i] + l1[i]
		count += 1
	else:
		l2[i + 1] = l2[i]
print(count)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
time = 0
len = 0
for i in arr:
	if i >= time:
		time += i
		len += 1
print(len)


input()
a = sorted([int(x) for x in input().split()])
k = 0
n = 0
for i in range(len(a)):
	if a[i] >= k:
		n += 1
		k += a[i]
print(n)


x = input()
x = int(x)
sez = input()
sez = sez.strip().split(' ')
sez = list(map(int, sez))
sez.sort()
count = 0
cakal = 0
i = 0
for i in range(len(sez)):
	if cakal <= sez[i]:
		count += 1
		cakal += sez[i]
print(count)


n = int(input())
a = list(map(int, input().split()))
a.sort()
b = []
s = 0
c = 0
for x in a:
	if s <= x:
		b.append(x)
		s += x
		c += 1
print(c)


def sum_array(a):
	s = 0
	for elem in a:
		s += elem
	return s
n = int(input())
queue = list(map(int, input().split()))
queue.sort()
sat = [True for i in range(n)]
s = 0
for i in range(n):
	if queue[i] < s:
		sat[i] = False
	s += queue[i]
free = 0
while sat[free] and free < n - 1:
	free += 1
next_person = free + 1
while next_person < n - 1:
	s = sum_array(queue[:free])
	while next_person < n - 1 and queue[next_person] < s:
		next_person += 1
	if queue[next_person] >= s:
		(queue[next_person], queue[free]) = (queue[free], queue[next_person])
		sat[free] = True
	while sat[free] and free < n - 1:
		free += 1
	next_person += 1
count = 0
for elem in sat:
	if elem:
		count += 1
print(count)


n = int(input())
ar = list(map(int, input().split()))
ar.sort()
visited = [0] * n
happy = 0
wait = 0
i = 0
while i < n:
	if wait <= ar[i]:
		happy += 1
		wait += ar[i]
		i += 1
	else:
		i += 1
print(happy)


n = int(input())
a = sorted([int(x) for x in input().split()])
num = 0
if n == 1:
	num = 1
i = 1
while i <= n - 1:
	if sum(a[0:i]) > a[i]:
		a.pop(i)
		n -= 1
	else:
		num += 1
		i += 1
print(len(a))


n = int(input())
A = [int(i) for i in input().split()]
A.sort()
time = 0
count = 0
for i in A:
	if time <= i:
		time += i
		count += 1
print(count)


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	n = int(input())
	t = list(map(int, input().split()))
	s = 0
	ans = 0
	for x in sorted(t):
		if x >= s:
			ans += 1
			s += x
	print(ans)
main()


n = int(input())
q = list(map(int, input().split()))
sat = 0
q.sort()
tot = 0
for i in q:
	if i >= tot:
		sat += 1
		tot += i
print(sat)


import heapq

def CF545D():
	N = int(input())
	people = list(map(int, input().split()))
	people = sorted(people, reverse=True)
	time = 0
	served = 0
	for i in range(N):
		p = people.pop()
		if p >= time:
			time += p
			served += 1
	return served
res = CF545D()
print(res)