Imagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if you do have a twin, then you very well know what it's like.

Now let's imagine a typical morning in your family. You haven't woken up yet, and Mom is already going to work. She has been so hasty that she has nearly forgotten to leave the two of her darling children some money to buy lunches in the school cafeteria. She fished in the purse and found some number of coins, or to be exact, n coins of arbitrary values a1, a2, ..., an. But as Mom was running out of time, she didn't split the coins for you two. So she scribbled a note asking you to split the money equally.

As you woke up, you found Mom's coins and read her note. "But why split the money equally?" — you thought. After all, your twin is sleeping and he won't know anything. So you decided to act like that: pick for yourself some subset of coins so that the sum of values of your coins is strictly larger than the sum of values of the remaining coins that your twin will have. However, you correctly thought that if you take too many coins, the twin will suspect the deception. So, you've decided to stick to the following strategy to avoid suspicions: you take the minimum number of coins, whose sum of values is strictly more than the sum of values of the remaining coins. On this basis, determine what minimum number of coins you need to take to divide them in the described manner.

Input

The first line contains integer n (1 ≤ n ≤ 100) — the number of coins. The second line contains a sequence of n integers a1, a2, ..., an (1 ≤ ai ≤ 100) — the coins' values. All numbers are separated with spaces.

Output

In the single line print the single number — the minimum needed number of coins.

Examples

Input

2
3 3


Output

2


Input

3
2 1 2


Output

2

Note

In the first sample you will have to take 2 coins (you and your twin have sums equal to 6, 0 correspondingly). If you take 1 coin, you get sums 3, 3. If you take 0 coins, you get sums 0, 6. Those variants do not satisfy you as your sum should be strictly more that your twins' sum.

In the second sample one coin isn't enough for us, too. You can pick coins with values 1, 2 or 2, 2. In any case, the minimum number of coins equals 2.

Difficulty: EASY
Tags: Sorting

Greedy algorithms
Skill types: Sorting

Greedy algorithms
Expected Time Complexity: O(NLOG(N))

Starter code:

Solutions:
n = int(input())
a = sorted(list(map(int, input().split())))[::-1]
b = sum(a) // 2
sum1 = count = 0
for i in a:
	sum1 += i
	count += 1
	if sum1 > b:
		break
print(count)


import math
n = int(input())
line = input()
coins = line.split(' ')
coinList = []
for coin in coins:
	coinList.append(int(coin))
coinList.sort(reverse=True)
totalList = []
totalVal = 0
for coinVal in coinList:
	totalVal = totalVal + coinVal
	totalList.append(totalVal)
index = 0
target = totalVal / 2
for total in totalList:
	index = index + 1
	if total > target:
		break
print(index)


user_input1 = input()
user_input2 = input()
valueArray = []
user_input2 = user_input2.split(' ')
total_amount = 0
for element in user_input2:
	total_amount += int(element)
	valueArray.append(int(element))
valueArray.sort(reverse=True)
target_amount = total_amount / 2
current_amount = 0
number_coins_taken = 0
while current_amount <= target_amount:
	current_amount += valueArray[0]
	valueArray.remove(valueArray[0])
	number_coins_taken += 1
print(number_coins_taken)


x = int(input())
y = list(map(int, input().split()))
y.sort(reverse=True)
z = 0
a = sum(y) / 2
for i in range(len(y)):
	z = z + y[i]
	if z > a:
		break
print(i + 1)


x = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
z = sum(a)
chu = 0
k = 0
while z >= chu:
	chu += a[0]
	a.pop(0)
	z = sum(a)
	k += 1
print(k)


n = int(input())
a = list(map(int, input().split()))
sum = 0
for i in range(n):
	sum += a[i]
a.sort(reverse=True)
for i in range(n + 1):
	take = 0
	for j in range(i):
		take += a[j]
	if take > sum - take:
		print(i)
		break


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


x = int(input())
y = input().split()
for i in range(len(y)):
	y[i] = int(y[i])
y.sort(reverse=True)
avg = sum(y) / 2
c = 0
sum = 0
for i in y:
	if sum > avg:
		break
	else:
		c += 1
		sum += i
print(c)


n = int(input())
cl = list(map(int, input().split()))
cl.sort(reverse=True)
total = sum(cl)
k = 0
c = 0
total = total / 2
for x in range(len(cl)):
	c += 1
	k += int(cl[x])
	if k > total:
		break
print(c)


n = int(input())
arr = list(map(int, input().split()))
curr = 0
arr.sort()
s = sum(arr)
i = n - 1
while i > -1:
	curr += arr[i]
	if curr > s - curr:
		break
	i -= 1
print(n - i)


a = int(input())
to = 0
lis = list(map(int, input().split()))
su = sum(lis) / 2
lis.sort(reverse=True)
for i in range(a):
	to = to + lis[i]
	if to > su:
		print(i + 1)
		break


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


(n, l, s, c) = (int(input()), sorted(map(int, input().split())), 0, 0)
while s <= sum(l):
	s += l.pop()
	c += 1
print(c)


number = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
amount = 0
rest = 0
taken = 0
rest = sum(coins)
for coin in coins:
	if amount > rest:
		break
	else:
		amount += coin
		rest -= coin
		taken += 1
print(taken)


import sys
n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
ans = 0
subs = 0
lsum = sum(l)
for v in l:
	subs += v
	ans += 1
	if subs > lsum // 2:
		break
print(ans)


n = int(input())
l = list(map(int, input().split()))
a = sorted(l)
a = a[::-1]
s = sum(l)
s1 = 0
c = 1
for i in a:
	s1 += i
	s -= i
	if s1 < s:
		c += 1
	elif s1 == s:
		c += 1
print(c)


num_coins = int(input())
coins = sorted([int(x) for x in input().split(' ')])
value = sum(coins) / 2
count = 0
total = 0
for i in range(len(coins) - 1, 0, -1):
	total += coins[i]
	count += 1
	if total > value:
		break
if not total > value:
	count += 1
print(count)


d = input()
a = sorted(list(map(int, input().split())))
b = len(a)
c = sum(a)
output = 0
numberOfCoins = 0
while output <= sum(a):
	output += a[-1]
	numberOfCoins += 1
	a.remove(a[-1])
print(numberOfCoins)


n = int(input())
x = list(map(int, input().split()))
x.sort(reverse=True)
(cou, j) = (0, 0)
y = sum(x)
for i in x:
	j = j + i
	cou += 1
	if j > y // 2:
		break
print(cou)


def coins():
	p = int(input())
	a = list(map(int, input().split(' ')))
	a.sort()
	a.reverse()
	k = 1
	while sum(a[:k]) <= sum(a[k:]):
		k += 1
	return k
print(coins())


n = int(input())
l = list(map(int, input().split()))
l.sort()
x = sum(l)
count = 0
for i in range(-1, -n - 1, -1):
	count = count + l[i]
	if count > x / 2:
		print(abs(i))
		break


n = int(input())
l = list(map(int, input().rstrip().split()))
s = sum(l)
m = 0
l.sort(reverse=True)
for i in range(n):
	m += l[i]
	if m > s / 2:
		break
print(i + 1)


import sys
monedas = []
total = 0
n = int(sys.stdin.readline())
cadena = sys.stdin.readline().split()
for i in range(len(cadena)):
	moneda = int(cadena[i])
	monedas.append(moneda)
	total += moneda
monedas.sort(reverse=True)
monedas_minimas = 0
mitad_monedas = total / 2
for i in range(len(monedas)):
	monedas_minimas += monedas[i]
	if monedas_minimas > mitad_monedas:
		print(i + 1)
		break


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


x = int(input())
y = map(int, input().split())
lst = []
total = 0
answ = 0
total2 = 0
for a in y:
	lst.append(a)
	total += a
lst = sorted(lst, reverse=True)
while total / 2 >= total2:
	total2 += lst[answ]
	answ += 1
print(answ)


n = int(input())
a = sorted([int(x) for x in input().split()])
a.reverse()
b = []
alpha = 0
for i in range(n):
	if sum(b) <= sum(a[i:]):
		b.append(a[i])
		alpha += 1
	else:
		break
print(alpha)


def min_coins(arr):
	arr = sorted(arr, reverse=True)
	i = 0
	left = 0
	half = sum(arr) / 2
	while left <= half:
		left += arr[i]
		i += 1
	return i
n = input()
print(min_coins([int(i) for i in input().split()]))


n = int(input())
arr = [eval(x) for x in input().split()]
arr.sort(reverse=True)
arr_sum_half = sum(arr) // 2 + 1
(count, sneak) = (0, 0)
for i in range(n):
	sneak += arr[i]
	if sneak < arr_sum_half:
		count += 1
	else:
		count += 1
		print(count)
		break


n = int(input())
coins = [int(i) for i in input().split()]
max_value = 0
cnt = 0
while max_value <= sum(coins):
	max_value = max_value + max(coins)
	coins.pop(coins.index(max(coins)))
	cnt = cnt + 1
print(cnt)


n = int(input())
m = list(map(int, input().split()))
m.sort()
m.reverse()
c = 0
s = 0
for i in range(len(m)):
	c += 1
	s += m[i]
	if s > sum(m) - s:
		break
print(c)


n = int(input())
lst = list(map(int, input().split()))
lst.sort(reverse=True)
tot = sum(lst)
mine = 0
counter = 0
while 2 * mine <= tot:
	mine += lst[counter]
	counter += 1
print(counter)


l = 0
m = 0
k1 = 0
n = int(input())
k2 = 0
k = input().split()
for i in range(len(k)):
	k[i] = int(k[i])
l = sum(k)
k = sorted(k)
k1 = l / 2
k1 = int(k1)
while k2 <= k1:
	n = n - 1
	k2 = k2 + k[n]
	m = m + 1
print(m)


n = int(input())
coins = [int(x) for x in input().split()]
tot = sum(coins)
bud = 0
num = 0
coins.sort(reverse=True)
for i in range(n):
	tot -= coins[i]
	bud += coins[i]
	num += 1
	if bud > tot:
		print(num)
		break


n = int(input())
l = sorted(list(map(int, input().split())), reverse=True)
s = sum(l) // 2
su = 0
count = 0
for i in l:
	if su > s:
		break
	su += i
	count += 1
print(count)


n = int(input())
l = list(map(int, input().split()))
l.sort()
s = c = 0
i = n - 1
while s <= sum(l):
	s += l.pop()
	c += 1
print(c)


from sys import stdin
input = stdin.readline
n = int(input())
coin = sorted(list(map(int, input().split())))
my_coin = 0
other_coin = sum(coin)
count = 0
while my_coin <= other_coin:
	count += 1
	take_coin = coin.pop()
	my_coin += take_coin
	other_coin -= take_coin
print(count)


n = int(input())
a = sorted(list(map(int, input().split())))
i = n - 1
while i >= 0:
	if sum(a[i:]) * 2 > sum(a):
		print(n - i)
		break
	i -= 1


n = input()
n = int(n)
c = input().split()
c = [int(x) for x in c]
m = sum(c) // 2
c.sort()
s = 0
i = n
while i > 0 and s <= m:
	i -= 1
	s += c[i]
print(n - i)


x = int(input())
a = list(map(int, input().split()))
su = int(sum(a) / 2)
a.sort(reverse=True)
mm = 0
i = 0
while mm <= su:
	mm += a[i]
	i += 1
print(i)


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


n = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse=True)
s = sum(a)
p = 0
for i in range(n):
	p += a[i]
	if p > s / 2:
		ans = i + 1
		break
print(ans)


x = int(input())
z = []
t = []
s = [int(n) for n in input().split()]
s.sort()
s = s[::-1]
for n in range(x):
	if sum(s[0:n]) > sum(s[n:x]):
		z.append(len(s[0:n]))
if len(z) > 0:
	print(min(z))
else:
	print(x)


count = int(input())
value = [int(x) for x in input().split(' ')]
value.sort(reverse=True)
summa = 0
i = 0
k = 0
while count >= 1:
	if summa <= sum(value) - summa:
		summa += value[i]
		k += 1
	i += 1
	count -= 1
print(k)


n = int(input())
coins = list(map(int, input().split(' ')))
sm = sum(coins)
coins.sort(reverse=True)
(sum2, cneed) = (0, 0)
for i in range(0, len(coins)):
	sum2 += coins[i]
	sm -= coins[i]
	cneed += 1
	if sum2 > sm:
		break
print(cneed)


array = []
summa = 0
count = 0
My_coins = 0
n = int(input())
string = list(map(int, input().split()))
for i in range(0, len(string)):
	array.append(int(string[i]))
	summa += int(string[i])
array.sort()
i = len(array) - 1
summa /= 2
while i > -1:
	My_coins += array[i]
	count += 1
	if summa < My_coins:
		break
	i -= 1
print(count)


n = input()
list = []
list = input().split(' ')
list = [int(x) for x in list]
list.sort()
list.reverse()
a = 0
i = 0
t = 0
for x in list:
	a = a + x
while i < int(n):
	t = t + int(list[i])
	if t > a - t:
		print(i + 1)
		break
	i = i + 1


n = int(input())
coins = input().split()
coins = [int(x) for x in coins]
coins.sort(reverse=True)
sum = 0
mine = 0
num = 0
for i in range(n):
	coin_i = coins[i]
	sum += coin_i
for i in range(n):
	coin_i = coins[i]
	mine += coin_i
	num += 1
	if mine > sum / 2:
		break
print(num)


n = int(input())
coins = list(map(int, input().split()))
coins.sort()
total = 0
a = len(coins)
compare = 0
count = 0
for i in range(0, len(coins)):
	total = total + coins[i]
i = -1
while True:
	compare = compare + coins[i]
	count = count + 1
	i = i - 1
	if compare > total / 2:
		print(count)
		break


t = int(input())
k = sorted(map(int, input().split()))
s = 0
c = 0
while s <= sum(k):
	s += k.pop()
	c += 1
print(c)


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


n = int(input())
x = list(map(int, input().split()))
x.sort()
y = 1
if len(x) == 2:
	if x[0] == x[1]:
		y = 2
elif len(x) == 1:
	if x[0] == 0:
		y = 0
else:
	z = -1
	adek = sum(x[z:len(x)])
	kaka = sum(x[0:z])
	while adek <= kaka:
		z -= 1
		adek = sum(x[z:len(x)])
		kaka = sum(x[0:z])
		y += 1
print(y)


n = int(input())
res = 0
count = 0
coin_values = []
coin_values = list(map(int, input().split()))
coin_values.sort(reverse=True)
total = sum(coin_values)
for item in coin_values:
	res += item
	count += 1
	if res > total - res:
		break
print(count)


n = int(input())
s = input()
a = [int(x) for x in s.split()]
arr = sorted(a, reverse=True)
summ = 0
sum_list = arr
for i in range(n):
	summ += arr[i]
	sum_list[i] = summ
r = summ / 2
for i in range(n):
	if sum_list[i] > r:
		print(i + 1)
		break


n = input()
a = sorted(list(map(int, input().split())))
flag = c = 0
while flag <= sum(a):
	flag += a.pop()
	c += 1
print(c)


n = int(input())
l = list(map(int, input().split()))
l.sort()
j = n - 1
s1 = sum(l)
s2 = 0
c = 0
while s2 <= s1 and j >= 0:
	s2 = s2 + l[j]
	s1 = s1 - l[j]
	j = j - 1
	c = c + 1
print(c)


n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
s1 = a[0]
s2 = sum(a[1:])
c = 1
i = 1
while i < n and s1 <= s2:
	s1 += a[i]
	s2 -= a[i]
	i += 1
	c += 1
print(c)


n = int(input())
a = sorted(list(map(int, input().split(' '))), reverse=True)
media = sum(a) / 2
out = 0
count = 0
for x in a:
	count = count + x
	out = out + 1
	if count > media:
		break
print(out)


n = int(input())
l = list(map(int, input().split()))
s = sum(l)
l.sort()
cnt = 0
x = 0
y = 0
for i in reversed(range(n)):
	x += l[i]
	s -= l[i]
	if x <= s:
		cnt += 1
	if x > s:
		cnt += 1
		break
print(cnt)


n = int(input())
coins = sorted(list(map(int, input().split())), reverse=True)
f = 0
s = sum(coins)
i = 0
k = 0
for i in coins:
	if f > s:
		break
	f += i
	s -= i
	k += 1
print(k)


t = int(input())
l = list(map(int, input().split()))
s = 0
cnt = 0
l.sort(reverse=True)
for i in range(0, t):
	s += l[i]
	t = sum(l) - s
	if s > sum(l) - s:
		cnt += 1
		print(cnt)
		break
	cnt += 1


n = int(input())
x = [int(i) for i in input().split()]
x.sort()
s = 0
b1 = 0
b2 = 0
for i in range(n):
	if b1 <= b2:
		b1 = b1 + x[-1]
		x = x[:-1]
		b2 = sum(x)
		s = s + 1
print(s)


n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
sB1 = sum(a)
sB2 = 0
res = 0
for i in a:
	if sB2 > sB1:
		break
	sB1 -= i
	sB2 += i
	res += 1
print(res)


n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
t = sum(a) // 2 + 1
if n == 1 or a[0] >= t:
	print(1)
else:
	for i in range(1, n):
		if a[0] + a[i] < t:
			a[0] += a[i]
		else:
			print(i + 1)
			break


from itertools import *
input()
a = list(accumulate(reversed(sorted(map(int, input().split())))))
print(sum((x <= a[-1] / 2 for x in a)) + 1)


n = int(input())
coins = [int(c) for c in input().split()]
coins.sort(reverse=True)
bcoins = sum(coins)
mycoins = 0
i = 0
while mycoins <= bcoins:
	mycoins += coins[i]
	bcoins -= coins[i]
	i += 1
print(i)


input()
coins = sorted(map(lambda x: int(x), input().split()), reverse=True)
bigHalf = 0
coinsNr = 0
total = sum(coins) / 2
for i in coins:
	if bigHalf > total:
		break
	bigHalf += i
	coinsNr += 1
print(coinsNr)


def main():
	n = int(input())
	L = list(map(int, input().split()))
	L.sort()
	L = L[::-1]
	(i, j, k) = (0, 0, 0)
	while i <= j:
		i += L[k]
		j = sum(L[k + 1:])
		k += 1
	print(k)
main()


a = int(input())
b = sorted(map(int, input().split()), reverse=True)
c = 0
for i in range(a):
	c += b[i]
	if c > sum(b) / 2:
		print(i + 1)
		break


a = int(input())
numbers = list(map(int, input().split()))
numbers.sort(reverse=True)
summ = 0
if a == 1:
	print(1)
else:
	for i in range(len(numbers)):
		summ += numbers[i]
	for i in range(a):
		sum1 = 0
		sum2 = 0
		minn = 1000
		for j in range(i):
			sum1 += numbers[j]
			sum2 = summ - sum1
			if sum1 > sum2:
				if j < minn:
					minn = j + 1
			elif sum1 == sum2:
				minn = a // 2 + 1
	print(minn)


n = int(input())
c = list(map(int, input().split()))
c.sort()
c.reverse()
total = sum(c)
amount = 0
minimum = 0
for i in c:
	if amount <= sum(c) / 2:
		amount += i
		minimum += 1
print(minimum)


x = int(input())
y = input().split()
lst = [int(value) for value in y]
lst = sorted(lst)
lst.reverse()
a = sum(lst) / 2
b = 0
count = 0
for value in lst:
	if b <= a:
		b += value
		count += 1
	else:
		break
print(count)


def main():
	n = int(input())
	s = [int(i) for i in input().split()]
	s.sort(reverse=True)
	sum_max = 0
	sum_mid = sum(s) / 2
	for i in range(0, n):
		if sum_max > sum_mid:
			print(i)
			break
		elif sum_max <= sum_mid:
			sum_max += s[i]
	else:
		print(len(s))
main()


no_of_coins = int(input())
coins = list(map(int, input().split(' ')))
coins = sorted(coins)[::-1]
i = 2
bro = coins[1:]
me = [coins[0]]
while sum(me) <= sum(bro):
	me = coins[:i]
	bro = coins[i:]
	i += 1
print(len(me))


num_of_coins = int(input())
coins = input().split(' ')
coins = [int(i) for i in coins]
coins = sorted(coins, reverse=True)
sum_of_coins = sum(coins)
count = 0
arry = []
for i in range(num_of_coins):
	arry.append(coins.pop(0))
	count += 1
	if sum(arry) > sum(coins):
		print(count)
		exit()
print(count)


n = int(input())
coins = list(input().split(' '))
i = 0
sum1 = sum2 = 0
while i < n:
	coins[i] = int(coins[i])
	sum1 += coins[i]
	i += 1
i = 0
coins.sort(reverse=True)
for coin in coins:
	sum2 += int(coin)
	i += 1
	if sum2 * 2 > sum1:
		break
print(i)


import sys
n = int(input())
a = sys.stdin.readline().split()
value = 0
coins = [int(x) for x in a]
coins.sort()
for i in range(n):
	value = value + coins[i]
count = 0
twinvalue = 0
for j in range(n - 1, -1, -1):
	twinvalue = twinvalue + coins[j]
	count += 1
	if twinvalue > value / 2:
		break
print(count)


import statistics
import math
import datetime
from collections import Counter
import itertools

def func(xx, yy):
	pass

def main():
	n = int(input())
	aa = sorted(list(map(int, input().split())), reverse=True)
	coins = 0
	total = 0
	bb = int(sum(aa) / 2)
	for x in aa:
		total += x
		coins += 1
		if total > bb:
			break
	print(coins)
main()


n = int(input())
l = [int(i) for i in input().split()]
l.sort(reverse=True)
total = sum(l)
sum = 0
coins = 0
for i in l:
	sum += i
	coins += 1
	total -= i
	if sum > total:
		print(coins)
		break


n = int(input())
s = list(map(int, input().split()))
p = sum(s) / 2
s.sort(reverse=True)
x = 0
for i in range(n):
	x += s[i]
	if x > p:
		print(i + 1)
		break


from math import *
from array import array
n = int(input())
li = array('i', [int(a) for a in input().split(' ')])
if sum(li) % 2 != 0:
	s = ceil(sum(li) / 2)
else:
	s = 1 + sum(li) // 2
sum1 = 0
coins = 0
li = sorted(li)
for i in range(n - 1, -1, -1):
	sum1 += li[i]
	if n == 1:
		coins += 1
		break
	elif sum1 >= s:
		coins += 1
		break
	coins += 1
print(coins)


n_count = int(input().strip())
coins = list(map(int, input().strip().split(' ')))
coins.sort(reverse=True)
cum_sum = [coins[0]]
for i in range(1, n_count):
	cum_sum.append(cum_sum[-1] + coins[i])
min_coins = 0
for i in range(n_count):
	if cum_sum[i] * 2 > cum_sum[-1]:
		min_coins = i + 1
		break
print(min_coins)


n = int(input())
arr = input().split()
arr = [int(x) for x in arr]
arr = sorted(arr, reverse=True)
sum = 0
for i in arr:
	sum += i
currsum = 0
count = 0
for i in arr:
	if currsum + i > sum - (currsum + i):
		print(count + 1)
		break
	else:
		currsum += i
		count += 1


import math
n = int(input())
a = list(map(int, input().strip().split()))[:n]
a = sorted(a, reverse=True)
s = sum(a)
t = 0
cnt = 0
if s % 2 == 0:
	req = math.ceil(s / 2) + 1
else:
	req = math.ceil(s / 2)
for i in range(0, len(a)):
	if t > req or t == req:
		break
	else:
		t = t + a[i]
		cnt = cnt + 1
print(cnt)


n = int(input())
nums = list(map(int, input().split()))
nums.sort(reverse=True)
total = sum(nums)
c = 0
for i in range(n):
	c += nums[i]
	if c > total / 2:
		print(i + 1)
		break


n = int(input())
l = list(map(int, input().split()))
(c, tot) = (0, 0)
l.sort(reverse=True)
while c < n and tot <= sum(l) - tot:
	tot += l[c]
	c += 1
print(c)


n = int(input())
m = sorted(map(int, input().split()))
s1 = sum(m)
s2 = 0
k = 0
for i in reversed(m):
	s2 += i
	s1 -= i
	k += 1
	if s2 > s1:
		break
print(k)


n = int(input())
summ = 0
ar = [int(n) for n in input().split()]
for el in ar:
	summ += el
ar.sort(reverse=True)
me = 0
bro = summ
num = 0
for el in ar:
	me += el
	bro -= el
	num += 1
	if me > bro:
		break
print(num)


n = int(input())
a = list(map(int, input().split()))
c = 0
s = sum(a)
s = s // 2
a = sorted(a)
s2 = 0
for i in range(n - 1, -1, -1):
	s2 += a[i]
	c += 1
	if s2 > s:
		break
print(c)


n = input()
n = int(n)
value = [int(x) for x in input().split()]
value.sort(reverse=True)
total = sum(value)
taken = 0
for i in range(n):
	for j in range(i + 1):
		taken = taken + value[j]
	if taken > total / 2:
		print(i + 1)
		break
	taken = 0


input()
desc_list = sorted(list(map(int, input().split(' '))), reverse=True)
sum_of_list = sum(desc_list)
for i in range(0, len(desc_list)):
	sum_of_sub = sum(desc_list[:i + 1])
	if sum_of_sub > sum_of_list - sum_of_sub:
		print(i + 1)
		break


n = int(input())
L = list(map(int, input().split()))
sum = 0
for i in range(len(L)):
	sum += L[i]
Minimum = sum / 2
for i in range(len(L) - 1):
	for j in range(i, len(L)):
		if L[j] > L[i]:
			(L[i], L[j]) = (L[j], L[i])
Money = 0
c = 0
for i in range(len(L)):
	Money += L[i]
	c += 1
	if Money > Minimum:
		print(c)
		break


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


n = int(input())
a = list(map(int, input().split()))
(s, c, t) = (0, 0, 0)
for i in a:
	s += i
a.sort(reverse=True)
for i in a:
	t = t + 1
	c = c + i
	s = s - i
	if c > s:
		break
print(t)


n = int(input())
s = 0
t = 0
a = [int(n) for n in input().split(' ')]
a = sorted(a)
a = a[::-1]
for i in range(n):
	s += a[i]
for i in range(n):
	t += a[i]
	s -= a[i]
	if t > s:
		print(i + 1)
		break


n = int(input())
coins = sorted(map(int, input().split(' ')))[::-1]
v = sum(coins)
get = 0
for i in range(n):
	get += coins[i]
	v -= coins[i]
	if get > v:
		print(i + 1)
		break


n = int(input(''))
sum = 0
great = 0
k = 0
l = list(map(int, input('').strip().split()))
l.sort(reverse=True)
if n >= 2:
	for i in range(n):
		sum = sum + l[i]
	for j in range(n):
		great = great + l[j]
		if great > sum / 2:
			k = j + 1
			break
		else:
			continue
	print(k)
else:
	print('1')


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


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


n = int(input())
l = list(map(int, input().split()))
l.sort()
l.reverse()
b = 0
s = sum(l)
k = 0
while b <= s // 2:
	b = b + l[k]
	k = k + 1
print(k)


n = int(input())
(*arr,) = map(int, input().split())
arr = sorted(arr, reverse=True)
sums = sum(arr)
temp = 0
count = 0
i = 0
while temp <= sums and i < n:
	sums -= arr[i]
	temp += arr[i]
	i += 1
	count += 1
print(count)


a = int(input())
b = input().split()
b = list(map(int, b))
b = sorted(b)
total = 0
for i in b:
	total = total + int(i)
sum = 0
n = 0
while a > 0:
	remain = 0
	n = n + 1
	sum = sum + int(b[a - 1])
	remain = total - sum
	if sum > remain:
		print(n)
		break
	a = a - 1


_ = input()
s = list(map(int, input().split()))
s.append(0)
s.sort()
s = s[::-1]
for i in range(len(s)):
	if sum(s[:i]) > sum(s[i:]):
		print(i)
		break


n = int(input())
a = list(map(int, input().split()))
x = sum(a)
l = 0
k = 0
a.sort(reverse=True)
for i in a:
	if l <= x:
		l += i
		k += 1
		x -= i
	else:
		break
print(k)


n = int(input())
a = [int(x) for x in sorted(input().split(), key=lambda x: int(x), reverse=True)]
for i in range(1, n + 1):
	if sum(a[:i]) > sum(a[i:]):
		print(i)
		break


n = int(input())
l = list(map(int, input().split()))
l.sort()
c = 0
for i in range(n - 1, -1, -1):
	if i == 0:
		c = n
		break
	elif sum(l[i:]) > sum(l[:i]):
		c = n - i
		break
print(c)


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
totalValue = sum(coins)
totalValueExpected = totalValue / 2
yourCoins = 0
yourAmount = 0
for coin in coins:
	if yourAmount > totalValueExpected:
		break
	else:
		yourCoins += 1
		yourAmount += coin
print(yourCoins)


n = int(input())
m = str.split(input())
for k in range(n):
	m[k] = int(m[k])
m.sort(reverse=True)
sum = 0
get = 0
for i in range(n):
	sum = sum + int(m[i])
for j in range(n):
	get = get + int(m[j])
	if get > sum / 2:
		print(j + 1)
		break
	else:
		continue


n = int(input(''))
s = input('')
v = s.split(' ')
ss = [int(i) for i in v]
re = sum(ss)
su = 0
while re >= su:
	re = sum(ss)
	if re >= su:
		m = max(ss)
		su += m
		ss.remove(m)
	else:
		continue
print(n - len(ss))


def main():
	trash = input()
	values = input().split(' ')
	values = [int(i) for i in values]
	values.sort()
	values.reverse()
	valuesum = 0
	for x in values:
		valuesum += x
	coins = 0
	valcoins = 0
	i = 0
	while valcoins <= valuesum / 2:
		valcoins += values[i]
		coins += 1
		i += 1
	print(coins)
main()


import math
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 primeFactor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i ** 2 <= n:
		if n % i == 0:
			return i
		i += 1
	return n

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

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

def main():
	n = int(input())
	arr = array()
	s = sum(arr) // 2
	arr = sorted(arr, reverse=True)
	s2 = 0
	cnt = 0
	for i in range(n):
		s2 += arr[i]
		cnt += 1
		if s2 > s:
			break
	print(cnt)
t = 1
for _ in range(t):
	main()


n = int(input())
a = [int(i) for i in input().split()]
s = sum(a) // 2
res = 0
k = 0
while res <= s:
	res += max(a)
	a[a.index(max(a))] = 0
	k += 1
print(k)


n = int(input())
coins = list(map(int, input().split()))
coins.sort()
sum_coins = sum(coins)
result = 0
num_coins = 0
for i in range(len(coins) - 1, -1, -1):
	result += coins[i]
	sum_coins -= coins[i]
	num_coins += 1
	if result > sum_coins:
		break
print(num_coins)


n = int(input())
ls = list(map(int, input().rstrip().split()))
me = sum(ls) // 2
su = 0
co = 0
ls.sort()
ls = ls[::-1]
for i in ls:
	if su > me:
		break
	su += i
	co += 1
print(co)


n = int(input())
arr = sorted([int(i) for i in input().split()], reverse=True)
tot = sum(arr)
you = 0
cnt = 0
for i in arr:
	you += i
	tot -= i
	cnt += 1
	if you > tot:
		break
print(cnt)


n = int(input())
a = [int(x) for x in input().strip().split()]
a.sort()
total = sum(a)
me = 0
for i in range(n):
	me += a.pop()
	if me > total - me:
		print(i + 1)
		break


n = int(input())
X = input()
x = X.split()
s = 0
c = 0
count = 0
for i in range(len(x)):
	x[i] = int(x[i])
	s += x[i]
for i in range(len(x)):
	M = max(x)
	c += M
	count += 1
	if c > s - c:
		print(count)
		break
	else:
		x.remove(M)


n = int(input())
coins = [k for k in map(int, input().split())]
for i in range(n - 1):
	for j in range(n - 1, i, -1):
		if coins[j] < coins[j - 1]:
			temp = coins[j]
			coins[j] = coins[j - 1]
			coins[j - 1] = temp
total = sum(coins)
stolen = 0
while total >= stolen:
	coin = coins.pop()
	stolen += coin
	total -= coin
print(n - len(coins))


n = int(input())
a = list(map(int, input().split(' ')))
removed_coins = []
minimum_needed_number_of_coins = 0
sum_of_the_remaining_coins = sum(a)
sum_of_the_removed_coins = sum(removed_coins)
while sum_of_the_remaining_coins >= sum_of_the_removed_coins:
	highest_value = max(a)
	a.remove(highest_value)
	removed_coins.append(highest_value)
	minimum_needed_number_of_coins += 1
	sum_of_the_remaining_coins = sum(a)
	sum_of_the_removed_coins = sum(removed_coins)
print(minimum_needed_number_of_coins)


n = int(input())
coins = []
new_coins = []
coins.append(input().split())
sum1 = 0
sum2 = 0
condition = 'False'
while condition == 'False':
	max_value = 0
	sum1 = 0
	sum2 = 0
	for i in range(len(coins[0])):
		if int(coins[0][i]) > max_value:
			max_value = int(coins[0][i])
		else:
			continue
	new_coins.append(max_value)
	for l in range(len(coins[0])):
		if max_value == int(coins[0][l]):
			coins[0].pop(l)
			break
		else:
			continue
	for j in range(len(new_coins)):
		sum1 += new_coins[j]
	for k in range(len(coins[0])):
		sum2 += int(coins[0][k])
	if sum1 > sum2:
		condition = 'True'
	else:
		condition = 'False'
print(len(new_coins))


input()
g = sorted(list(map(int, input().split())))
mx = ct = 0
while mx <= sum(g):
	mx += g.pop()
	ct += 1
print(ct)


n = int(input())
a = list(map(int, input().split()[:n]))
a.sort()
a.reverse()
s = []
for i in range(n):
	s.append(a[i])
	if sum(s) <= sum(a) / 2:
		continue
	else:
		break
print(len(s))


n = int(input())
data = sorted([int(i) for i in input().split()])
s = sum(data)
c = 0
res = 0
for x in data[::-1]:
	c += x
	res += 1
	if c > s - c:
		print(res)
		quit()


n = int(input())
li = input().split()
main_li1 = []
main_li2 = []
for i in li:
	main_li1.append(int(i))
main_li2 = sorted(main_li1)
main_li2.reverse()
(sum_m, sum_l, count) = (0, 0, 0)
for (pos, i) in enumerate(main_li2):
	sum_m += int(i)
	count += 1
	for j in main_li2[pos + 1:]:
		sum_l += int(j)
	if sum_m > sum_l:
		print(count)
		break
	else:
		sum_l = 0


n = int(input())
l = list(map(int, input().split(' ')))
s = sum(l)
l.sort(reverse=True)
goal = s / 2
nb = 0
c = 0
while c <= goal:
	c += l[nb]
	nb += 1
print(nb)


n = input()
n = int(n)
k = input()
k = k.strip()
k = k.split()
for i in range(0, len(k)):
	k[i] = int(k[i])
k.sort()
addi = sum(k)
addi = addi // 2
coins = 0
nsum = 0
for i in range(len(k) - 1, -1, -1):
	nsum = nsum + k[i]
	coins = coins + 1
	if nsum > addi:
		break
print(coins)


n = int(input())
a = input().split()
a = [int(i) for i in a]
for i in range(n):
	for j in range(n - 1):
		if a[j] < a[j + 1]:
			(a[j], a[j + 1]) = (a[j + 1], a[j])
sl = a[0]
sr = 0
if n > 1:
	for i in range(1, n):
		sr += a[i]
k = 1
while sl <= sr:
	sl += a[k]
	sr -= a[k]
	k += 1
print(k)


input()
coins = list(map(int, input().split(' ')))
coins.sort()
coins.reverse()
a = sum(coins)
b = 0
d = 0
for c in coins:
	b += c
	a -= c
	d += 1
	if b > a:
		break
print(d)


import sys
import math

def twins():
	datain = []
	solved = 0
	totcoins = 0
	for i in range(2):
		datain.append(input().split())
	coins = [int(x) for x in datain[1]]
	sumofcoins = sum(coins)
	coins.sort()
	coins.reverse()
	for i in range(len(coins)):
		totcoins += coins[i]
		if totcoins > sumofcoins / 2:
			print(i + 1)
			return
twins()


num = int(input())
a = list(map(int, input().split()))
a.sort()
s = sum(a)
s2 = 0
count = 0
for i in range(num - 1, -1, -1):
	s2 += a[i]
	count += 1
	if s2 > s // 2:
		print(count)
		break


from functools import cmp_to_key

def reverse_numeric(x, y):
	return y - x
while True:
	try:
		n = int(input())
		a = []
		a = input().split()
		for i in range(n):
			a[i] = int(a[i])
		b = sorted(a, key=cmp_to_key(reverse_numeric))
		for j in range(n):
			p = 0
			q = 0
			for mae in range(j + 1):
				p += b[mae]
			for ato in range(j + 1, n):
				q += b[ato]
			if p > q:
				print(j + 1)
				break
	except:
		break


k = int(input())
a = list(map(int, input().split()))
a.sort()
a = a[::-1]
i = 0
c = 0
b = sum(a)
while c <= b:
	c += a[i]
	b = a[i + 1:]
	b = sum(b)
	i += 1
print(i)


def Twin():
	n = int(input())
	s = 0
	a = []
	flag = 0
	if n >= 1 and n <= 100:
		a = [int(n) for n in input().split()]
		i = 0
		while i < n:
			j = i
			while j < n:
				if a[i] < a[j]:
					temp = a[i]
					a[i] = a[j]
					a[j] = temp
				j = j + 1
			i = i + 1
		i = 0
		while i < n:
			s = s + a[i]
			s1 = sum(a[i + 1:])
			if s > s1:
				flag = i + 1
				break
			i = i + 1
		print(flag)
	else:
		print('Bad Entry')
		return
Twin()


n = int(input())
l = list(map(int, input().split()))
(c, cn) = (0, 0)
sm = sum(l)
l.sort(reverse=True)
for i in l:
	if c > sm:
		break
	else:
		cn += 1
		c += i
		sm -= i
print(cn)


n = int(input())
a = sorted([int(x) for x in input().split()], reverse=True)
num = 0
s = sum(a) / 2
for i in range(n):
	num += a[i]
	if num > s:
		print(i + 1)
		break


coins = int(input())
coinValue = input().split()
for i in range(0, coins):
	coinValue[i] = int(coinValue[i])
coinValue.sort(reverse=True)
sum = 0
for i in range(0, coins):
	sum = sum + int(coinValue[i])
max = 0
numCoin = 0
for i in range(0, coins):
	max = max + int(coinValue[i])
	numCoin += 1
	if max > sum // 2:
		print(numCoin)
		break


coin_number = input()
coins = input().split()
coins_1 = []
for coin0 in coins:
	coin1 = int(coin0)
	coins_1.append(coin1)
money = sum(coins_1)
coins_1.sort()
coins_1.reverse()
ans = 0
my_money = 0
for coin in coins_1:
	if my_money <= money / 2:
		my_money += coin
		ans += 1
print(ans)


N = int(input())
A = [int(x) for x in input().split()]
A.sort()

def SumaTotal(L):
	S = 0
	for k in range(len(L)):
		S += L[k]
	return S
ST = SumaTotal(A)
SumaAux = 0
C = 0
while SumaAux <= ST:
	SumaAux += A[-1]
	ST -= A[-1]
	A = A[:len(A) - 1]
	C += 1
print(C)


inputCount = int(input())
inputList = sorted(list(map(lambda x: int(x) if x != '' else None, input().split(' '))), reverse=True)
aim = sum(inputList) / 2
(s, r) = (0, 0)
for i in inputList:
	s += i
	r += 1
	if s > aim:
		break
print(r)


n = int(input())
string = input()
list = string.split(' ')
coins = []
flag = 'false'
i = n - 1
for item in list:
	coins.extend([int(item)])
coins.sort()
while flag == 'false':
	if sum(coins[i:]) > sum(coins[:i]):
		flag = 'true'
	else:
		i = i - 1
print(n - i)


inp = lambda : map(int, input().split())
n = int(input())
a = list(inp())
a.sort()
s = sum(a)
cur_sum = 0
cnt = 0
for k in range(n - 1, -1, -1):
	cur_sum += a[k]
	cnt += 1
	if cur_sum > s / 2.0:
		break
print(cnt)


input()
c = sorted(map(int, input().split()), reverse=True)
a = b = 0
while a <= sum(c) / 2:
	a += c[b]
	b += 1
print(b)


n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
sum_a = sum(a)
sum_b = 0
for i in range(len(a)):
	sum_b += a[i]
	if sum_b > sum_a // 2:
		print(i + 1)
		break


n = int(input())
coins = list(map(int, input().split()))
coins = sorted(coins, reverse=True)
mine = 0
ans = 0
while sum(coins) >= mine:
	mine = mine + coins[0]
	ans += 1
	del coins[0]
print(ans)


def calc(n, a):
	a.sort(reverse=True)
	s = sum(a)
	su = 0
	val = 0
	for i in range(n):
		su += a[i]
		s = s - a[i]
		if su > s:
			val = i
			break
	print(val + 1)
n = int(input())
a = list(map(int, input().split()))
calc(n, a)


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
s = 0
for i in range(len(a)):
	s += a[i]
s = s // 2
s2 = 0
count = 0
a.reverse()
for i in range(len(a)):
	s2 += a[i]
	count += 1
	if s2 > s:
		break
print(count)


w = input()
c = input()
l = c.split(' ')
l = [int(x) for x in l]
l.sort(reverse=True)
for x in range(1, int(w)):
	m = l[:x]
	h = l[x:]
	if sum(m) > sum(h):
		print(x)
		break
else:
	print(int(w))


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
total = sum(a)
my = 0
counter = 0
for x in a:
	if my <= total - my:
		my = my + x
		counter = counter + 1
	else:
		break
print(counter)


n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
l = l[::-1]
summ = sum(l)
cnt = 0
p = 0
for x in l:
	if p + x < summ - x:
		cnt += 1
		summ -= x
		p += x
	elif p + x == summ - x:
		cnt += 1
		p += x
	else:
		cnt += 1
		break
print(cnt)


n = input()
li = list(map(int, input().split(' ')))
li.sort(reverse=True)
sums = 0
count = 0
for i in li:
	if sums > sum(li) - sums:
		break
	sums += i
	count += 1
print(count)


n = input()
line = input()
coin = [int(i) for i in line.split()]
sum = sum(coin)
t = 0
count = 0
coin.sort(reverse=True)
for i in coin:
	t += i
	sum -= i
	count += 1
	if t > sum:
		break
print(count)


x = int(input())
coins = input().split(' ')
coins = [int(i) for i in coins]
coins.sort(reverse=True)
a = 0
if x == 1:
	print(1)
else:
	for i in range(x):
		a += coins[i]
		if a > sum(coins[i + 1:]):
			print(i + 1)
			break


n = int(input())
lists = [int(i) for i in input().split()]
lists.sort()
lists.reverse()
n = len(lists)
m = 0
z = 0
h = 0
for i in range(n):
	m = lists[i] + m
p = m / 2
for i in range(n):
	if z <= p:
		z = z + lists[i]
		h = h + 1
	else:
		z = z
		h = h
print(h)


from sys import stdin, exit
n = int(stdin.readline().rstrip())
coins = list(map(int, stdin.readline().rstrip().split(' ')))
coins.sort()
s = sum(coins)
me = 0
for i in range(len(coins) - 1, -1, -1):
	me += coins[i]
	s -= coins[i]
	if me > s:
		print(len(coins) - i)
		exit()


import sys
n = input()
n = int(n)
tmp = input()
s = list(map(int, tmp.split(' ')))
s.sort(reverse=True)
a = 0
b = 0
for i in range(0, len(s)):
	a = 0
	b = 0
	for j in range(0, i):
		a += s[j]
	for k in range(i, len(s)):
		b += s[k]
	if a > b:
		print(i)
		sys.exit()
print(len(s))
sys.exit()


N = int(input())
x = list(map(int, input().split()))
m = sum(x)
x.sort()
currsum = 0
i = N - 1
while currsum <= m - currsum:
	currsum += x[i]
	i -= 1
print(N - i - 1)


n = int(input())
coin = list(map(int, input().split()))
coin.sort(reverse=True)
for i in range(n):
	if sum(coin[:i + 1]) > sum(coin[i + 1:]):
		print(len(coin[:i + 1]))
		break


coins = []
coinsValueTotal = 0
n = int(input())
inputs = input().split(' ')
for i in range(len(inputs)):
	coin = int(inputs[i])
	coins.append(coin)
	coinsValueTotal += coin
coins.sort(reverse=True)
minCoins = 0
halfCoinsValueTotal = coinsValueTotal / 2
for i in range(len(coins)):
	minCoins += coins[i]
	if minCoins > halfCoinsValueTotal:
		print(i + 1)
		break


n = int(input())
b = input().split()
a = []
for i in b:
	i = int(i)
	a.append(i)
a.sort(reverse=-1)
s = []
if len(a) == 1:
	print(1)
else:
	while True:
		if sum(s) > sum(a):
			print(len(s))
			break
		if sum(s) == sum(a):
			print(len(s) + 1)
			break
		temp = a[0]
		a.remove(a[0])
		s.append(temp)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
s = sum(a)
i = n - 1
while i >= 0:
	tot = 0
	for j in range(i, n):
		tot = tot + a[j]
	if tot > s / 2:
		print(n - i)
		break
	i = i - 1


import itertools
import sys
args = sys.stdin.read().splitlines()
num_coins = int(args[0])
coins = [int(x) for x in args[1].split(' ')]
coins.sort(reverse=True)
if num_coins == 1:
	print(1)
if num_coins == 2 and coins[0] == coins[1]:
	print(2)
for i in range(num_coins):
	keep = coins[:i]
	give = coins[i:]
	if sum(keep) > sum(give):
		print(i)
		break


n = int(input())
coins = list(map(int, input().split(' ')))
coins.sort()
coins.reverse()
var = sum(coins)
res = 0
cur = 0
for i in coins:
	cur += i
	if cur <= var // 2:
		res += 1
		continue
	else:
		print(res + 1)
		exit()
print(res)


from sys import stdin, stdout

def get_int():
	return int(stdin.readline().strip())

def get_ints():
	return map(int, stdin.readline().strip().split())
n = get_int()
ai = sorted(list(get_ints()), reverse=True)
sum = sum(ai)
ans = 0
taken = 0
for coin in ai:
	taken += coin
	sum -= coin
	ans += 1
	if taken > sum:
		break
stdout.write(str(ans))


n = int(input().strip())
l = sorted(list(map(int, input().strip().split())), reverse=True)
for i in range(n + 1):
	if sum(l[:i]) > sum(l[i:]):
		print(i)
		break


n = int(input())
l = list(map(int, input().split()))
l.sort()
l1 = l[::-1]
sum = 0
c = 0
cp = 0
s = 0
for i in l1:
	sum = sum + i
for i in l1:
	s = s + i
	c = sum - s
	cp = cp + 1
	if s > c:
		print(cp)
		break


n = int(input())
cns = list(map(int, input().split()))
cns.sort(key=int, reverse=True)
sum1 = 0
ncns = 0
tsum = sum(cns)
for item in cns:
	sum1 += item
	ncns += 1
	if sum1 > tsum / 2:
		break
print(ncns)


def merge_sort(string):
	if len(string) == 1:
		return string
	left = []
	right = []
	for i in range(0, len(string)):
		if i < len(string) / 2:
			left.append(string[i])
		else:
			right.append(string[i])
	left = merge_sort(left)
	right = merge_sort(right)
	return merge(left, right)

def merge(left, right):
	ret = []
	while len(left) > 0 and len(right) > 0:
		if left[0] < right[0]:
			ret.append(right[0])
			right = right[1:]
		else:
			ret.append(left[0])
			left = left[1:]
	while len(left) > 0:
		ret.append(left[0])
		left = left[1:]
	while len(right) > 0:
		ret.append(right[0])
		right = right[1:]
	return ret
n = int(input())
string = list(map(int, input().strip().split()))
value = int(sum(string) / 2)
sort = merge_sort(string)
val = []
for i in range(0, len(string)):
	val.append(sort[i])
	if sum(val) > value:
		print(len(val))
		break


import sys
inte = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
for i in range(1, len(a) + 1):
	if sum(a[0:i]) > sum(a[i:]):
		break
print(i)


n = int(input())
a = list(map(int, input().split()))
total = sum(a)
total = total / 2
a.sort(reverse=True)
temp = 0
c = 0
for i in a:
	temp += i
	c += 1
	if temp > total:
		break
print(c)


n = int(input())
line = input().split()
L = []
for i in range(n):
	L.append(int(line[i]))
line = sorted(L)
k = n
sum1 = 0
for i in range(k):
	sum1 += int(line[i])
(sum2, count) = (0, 0)
while k > 0:
	sum2 += int(line[k - 1])
	if 2 * sum2 <= sum1:
		count += 1
		k -= 1
	else:
		count += 1
		break
print(count)


a = int(input())
b = sorted(list(map(int, input().split())))
c = int(sum(b) / 2)
fi = 0
for i in range(a):
	fi = fi + b[a - 1 - i]
	coun = i + 1
	if fi > c:
		break
print(coun)


num = int(input())
values = list(map(int, input().split()))
values.sort(reverse=True)
sum1 = 0
sum2 = 0
for i in range(0, num):
	sum1 = sum1 + values[i]
	sum2 = sum(values[i + 1:num])
	if sum1 > sum2:
		print(i + 1)
		break


a = int(input())
b = input().split(' ')
newb = []
sum = 0
c = 0
take = 0
for i in range(a):
	newb.append(int(b[i]))
	sum = sum + int(b[i])
newb = sorted(newb, reverse=True)
for i in range(a):
	if sum < take:
		break
	sum = sum - newb[i]
	take = take + newb[i]
	c = c + 1
print(c)


n = int(input())
a = list(map(int, input().split()))
s_me = 0
s_ost = sum(a)
count = 0
while s_me <= s_ost:
	max_a = max(a)
	s_me += max_a
	a.remove(max_a)
	s_ost = sum(a)
	count += 1
print(count)


n = int(input())
l = list(map(int, input().split()))
l.sort()
s = 0
count = 0
while s <= sum(l):
	n = len(l)
	s = s + l[n - 1]
	count += 1
	l.remove(l[n - 1])
print(count)


num = int(input())
value = [int(x) for x in input().split()]
s = value.sort(reverse=True)
half = sum(value) / 2
total = 0
for i in range(num):
	a = value[i]
	total += a
	if total > half:
		break
print(i + 1)


numberOfCoins = input()
coins = input()
coins = list(map(int, coins.split()))
coins.sort(reverse=True)
coinSum = sum(coins)
myCoinSum = 0
answer = 0
for coin in coins:
	myCoinSum += coin
	coinSum -= coin
	answer += 1
	if myCoinSum > coinSum:
		break
print(answer)


n = int(input())
coins = sorted(map(int, input().split()))
total = sum(coins)
my_total = 0
ncoins = 0
while my_total <= total:
	coin = coins.pop()
	ncoins += 1
	my_total += coin
	total -= coin
print(ncoins)


n = int(input())
l = list(map(int, input().split(' ')))
sumf = 0
sum2 = 0
count = 0
for i in l:
	sumf += i
l.sort(reverse=True)
count = 0
sumf //= 2
for i in l:
	sum2 += i
	count += 1
	if sum2 > sumf:
		print(count)
		break


n = int(input())
a = list(map(int, input().split()))
if n == 2 and a[0] == a[1]:
	print('2')
elif n == 2 and a[0] != a[1]:
	print('1')
elif n == 1:
	print('1')
else:
	x = sum(a)
	x = x // 2
	a.sort()
	c = 0
	ans = 0
	for i in range(n)[::-1]:
		ans = ans + a[i]
		c = c + 1
		if ans > x:
			break
	print(c)


n = int(input())
a = []
a = list(map(int, input().split()))
a.sort()
a.reverse()
s = sum(a)
m = 0
c = 0
for i in a:
	m += i
	c += 1
	if 2 * m > s:
		break
print(c)


n = int(input())
(*coins,) = map(int, input().split())
srtd_coins = sorted(coins, reverse=True)
summ = sum(coins)
splt = summ / 2
count = 0
temp = 0
for coin in srtd_coins:
	count += 1
	temp += coin
	if temp > splt:
		break
print(count)


n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
s = 0
ct = flag = 0
for i in range(len(l) - 1, -1, -1):
	s = s + l[i]
	ct += 1
	if s > sum(l[:i]):
		print(ct)
		flag = 1
		break
if flag == 0:
	print('0')


i = o = 0
input()
y = sorted(map(int, input().split()))
while o <= sum(y) / 2:
	(o, i) = (o + y[~i], i + 1)
print(i)


n = int(input())
x = list(map(int, input().split()))
x = sorted(x, reverse=True)
f = sum(x)
c = 0
for i in range(n):
	if c > f // 2:
		print(i)
		exit()
	c += x[i]
print(n)


n = int(input())
l1 = [int(x) for x in input().split()]
total_sum = sum(l1)
coin_sum = 0
count = 0
l1.sort(reverse=True)
for coin in l1:
	if not coin_sum > total_sum:
		count += 1
		coin_sum += coin
		total_sum -= coin
	else:
		break
print(count)


c = int(input())
s = input().split(' ')
s = [int(x) for x in s]
s.sort(reverse=True)
count = 0
sum1 = 0
for x in s:
	sum1 = sum1 + x
	count = count + 1
	if sum1 > sum(s) / 2:
		break
print(count)


Lista = []
SumaCalkowita = Wynik = 0
Ile = int(input())
CiagZKlawiatury = input().split(' ')
for i in range(Ile):
	Lista.append(int(CiagZKlawiatury[i]))
	SumaCalkowita += Lista[i]
Lista.sort()
Lista.reverse()
SumaPoczatkowa = 0
for i in range(Ile):
	SumaPoczatkowa += Lista[i]
	SumaCalkowita -= Lista[i]
	if SumaPoczatkowa > SumaCalkowita:
		Wynik = i + 1
		break
print(Wynik)


int(input())
a = sorted([int(i) for i in input().split()], reverse=True)
sum_all = sum(a)
my_sum = 0
for (i, el) in enumerate(a):
	my_sum += el
	sum_all -= el
	if my_sum > sum_all:
		print(i + 1)
		exit(0)


n = int(input())
coins = []
coins = [int(x) for x in input().split(' ')]
coins = sorted(coins, reverse=True)
first_sum = second_sum = 0
mum_no_of_coins = 0
for i in range(n):
	first_sum += coins[i]
	second_sum = 0
	for j in range(i + 1, n):
		second_sum += coins[j]
	if first_sum > second_sum:
		mum_no_of_coins = i + 1
		break
print(mum_no_of_coins)


n = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
k = sum(A)
l = 0
i = 0
while i < n and l <= k - l:
	l += A[i]
	i += 1
print(i)


a = int(input())
b = [int(x) for x in input().split()]
b.sort(reverse=True)
for i in range(1, a + 1):
	if sum(b[:i]) > sum(b[i:]):
		print(i)
		break


def merge(arr1, arr2, arr):
	n = len(arr1)
	m = len(arr2)
	i = j = k = 0
	while i < n and j < m:
		if arr1[i] < arr2[j]:
			arr[k] = arr1[i]
			i += 1
		else:
			arr[k] = arr2[j]
			j += 1
		k += 1
	while i < n:
		arr[k] = arr1[i]
		i += 1
		k += 1
	while j < m:
		arr[k] = arr2[j]
		k += 1
		j += 1
	return arr

def merge_sort(a):
	if len(a) == 1 or len(a) == 0:
		return
	mid = len(a) // 2
	a1 = a[:mid]
	a2 = a[mid:]
	merge_sort(a1)
	merge_sort(a2)
	merge(a1, a2, a)
n = int(input())
arr = list(map(int, input().split()))
arrsum = sum(arr) // 2
merge_sort(arr)
arr = arr[::-1]
currsum = 0
res = 0
for i in range(n):
	currsum += arr[i]
	res += 1
	if currsum > arrsum:
		break
print(res)


n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
s = 0
c = 0
cnt = 0
for i in l:
	s += i
for i in l[::-1]:
	c += i
	cnt += 1
	if c > s / 2:
		break
print(cnt)


n = int(input())
s = input().split()
s = list(map(int, s))
total = sum(s)
s.sort()
s.reverse()
sum = 0
for i in range(n):
	sum += s[i]
	if sum >= total // 2 + 1:
		print(i + 1)
		break


n = int(input())
arr = map(int, input().split())
l = list(arr)
x = sum(l)
l.sort(reverse=True)
p = 0
for i in range(n):
	x = x - l[i]
	p = p + l[i]
	if p > x:
		break
print(i + 1)


number = input('')
values = input('')
coins = list(map(int, values.split(' ')))
coins_taken = 0
mine = 0
twin = sum(coins)
coins_sort = sorted(coins, reverse=True)
while mine <= twin:
	coin = coins_sort.pop(0)
	mine += coin
	twin -= coin
	coins_taken += 1
print(coins_taken)


n = int(input())
coins = input().split()
sc = 0
st = 0
nr = 0
for i in range(n):
	coins[i] = int(coins[i])
	st += coins[i]
coins.sort()
while sc <= st:
	temp = coins.pop()
	sc += temp
	st -= temp
	nr += 1
print(nr)


n = int(input())
coins = list(map(int, input().split()))
x = sum(coins)
c = 0
r = 0
while c <= x:
	m = max(coins)
	c += m
	r += 1
	x -= m
	coins.pop(coins.index(m))
print(r)


n = input()
coins = list(map(int, input().split()))
coins.sort(reverse=True)
for i in range(0, len(coins) + 1):
	firstslice = coins[:i]
	secondslice = coins[i:]
	if sum(firstslice) > sum(secondslice):
		print(i)
		break


n = int(input())
a = list((float(x) for x in input().split()))
suma = sum(a)
a.sort()
(cnt, i) = (1, n - 1)
thesuma = a[n - 1]
while thesuma <= suma / 2:
	i -= 1
	cnt += 1
	thesuma += a[i]
print(cnt)


n = int(input())
lis = list(map(int, input().split()))
lis.sort()
lis.reverse()
ans = 0
coins = 0
value = sum(lis) // 2
for i in lis:
	if coins <= value:
		coins += i
		ans += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
pol = sum(a) / 2
s = 0
count = 0
while True:
	if s > pol:
		break
	else:
		m = max(a)
		s += m
		count += 1
		a.remove(m)
print(count)


n = int(input())
l1 = list(map(int, input().split()))
l1.sort()
s = sum(l1)
gh = 0
nc = 0
for i in range(n - 1, -1, -1):
	if gh > s // 2:
		break
	else:
		gh = gh + l1[i]
		nc += 1
print(nc)


import sys

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

def iinput():
	return int(input())

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

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
n = iinput()
a = list(map(int, input().split()))
a.sort()
c1 = sum(a)
c2 = 0
i = 0
while c2 <= c1:
	c2 += a[len(a) - i - 1]
	c1 -= a[len(a) - i - 1]
	i += 1
print(i)


n = int(input())
a = [int(k) for k in input().split(' ')]
a.sort(reverse=True)
i = 1
x = a[:i]
y = a[i:]
while sum(x) <= sum(y):
	i += 1
	x = a[:i]
	y = a[i:]
print(len(x))


n = input()
nList = input().split()
nList = [int(i) for i in nList]
nList.sort(reverse=True)
mid = sum(nList) / 2
i = 0
count = 0
mine = 0
while mine <= mid:
	mine += nList[i]
	count += 1
	i += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
s = sum(a)
m = 0
count = 0
for i in range(n):
	m += a[i]
	count += 1
	if m > s / 2:
		break
print(count)


n = int(input())
count = 0
coins = list(map(int, input().split()))
s = sum(coins)
coins.sort(reverse=True)
s1 = 0
while s1 <= s // 2:
	s1 += coins[count]
	count += 1
print(count)


n = int(input())
a = list(input().split())
for i in range(n):
	a[i] = int(a[i])
a.sort(reverse=True)
sum = 0
for x in a:
	sum += int(x)
res = 0
for i in range(n):
	res += int(a[i])
	if res > sum - res:
		print(i + 1)
		exit()


n = int(input())
lst = []
sum = 0
for i in input().split():
	num = int(i)
	sum += num
	lst.append(num)
lst.sort(reverse=True)
sum /= 2
tempsum = 0
counter = 0
for i in lst:
	if tempsum > sum:
		break
	tempsum += i
	counter += 1
print(counter)


a = int(input())
b = list(map(int, input().split()))
b.sort()
c = len(b)
d = sum(b)
e = d / 2
i = c - 1
j = 0
f = 0
while f < e:
	f = f + int(b[i])
	i -= 1
	j += 1
if e == f:
	print(j + 1)
else:
	print(j)


n = int(input())
d = str(input())
s = d.split()
tm = 0
um = 0
l = []
ans = 0
for i in s:
	i = int(i)
	tm += i
	l += [i]
l.sort(reverse=True)
while um <= tm:
	ans += 1
	um += l[0]
	tm -= l[0]
	l.pop(0)
print(ans)


n = input()
values = [int(x) for x in input().split()]
values.sort(reverse=True)
coins_sum = 0
for i in range(len(values)):
	coins_sum += values[i]
	if coins_sum > sum(values[i + 1:]):
		coins = i + 1
		break
print(coins)


n = int(input())
l = list(map(int, input().strip().split()))
l.sort()
l.reverse()
r = []
t = 1
d = sum(l) / 2
for i in l:
	r.append(i)
	if sum(r) <= d:
		t += 1
print(t)


n = int(input())
a = [int(x) for x in input().split()]
c = 0
(sum1, sum2) = (0, 0)
a.sort(reverse=True)
for i in range(n):
	sum1 = 0
	sum2 = 0
	for j in range(i + 1):
		sum1 += a[j]
	for j in range(i + 1, n):
		sum2 += a[j]
	if sum1 > sum2:
		c = i + 1
		break
print(c)


n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
Sum = 0
for x in range(n):
	Sum += a[x]
b = 0
for x in range(n):
	b += a[x]
	if b > Sum - b:
		print(x + 1)
		break


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
total_coins = 0
for i in range(0, len(a)):
	total_coins = total_coins + a[i]
needed_coins = list()
for i in range(0, len(a)):
	needed_coins.append(a[i])
	if sum(needed_coins) > total_coins - sum(needed_coins):
		break
print(len(needed_coins))


n = int(input())
a = list(map(int, input().split()))
count = 0
a.sort(reverse=True)
tsum = sum(a)
yoursum = 0
for i in a:
	yoursum += i
	count += 1
	if yoursum > tsum - yoursum:
		break
print(count)


n = int(input())
c = list(map(int, input().split()))
c.sort()
i = 0
while True:
	if sum(c[0:n - i - 1]) < sum(c[n - i - 1:n]):
		print(i + 1)
		break
	i = i + 1


n = int(input())
ms = input().split(' ')
m = list()
for s in ms:
	m.append(int(s))
m.sort()
m.reverse()
su = 0
for l in m:
	su += l
s = 0
c = 0
for i in m:
	s += i
	c += 1
	if s > su - s:
		break
print(c)


from sys import stdin, stdout
n = int(stdin.readline())
values = sorted(list(map(int, stdin.readline().split())), reverse=True)
i = 1
while sum(values[:i]) <= sum(values) / 2:
	i += 1
stdout.write(str(i))


n = int(input())
mo = input().split()
sum = 0
answer = 0
sumt = 0
for i in range(len(mo)):
	sum = sum + int(mo[i - 1])
	mo[i - 1] = int(mo[i - 1])
mo.sort()
mo.reverse()
i = 1
while i <= n:
	sumt = sumt + int(mo[i - 1])
	answer = answer + 1
	i = i + 1
	if sumt >= sum // 2 + 1:
		i = n + 1
print(str(answer))


batas = int(input())
angka = input().split(' ')
x = len(angka)
tot = 0
data = []
hasil = 0
koin = 0
for i in range(x):
	tot += int(angka[i])
rata = tot / 2
for i in range(x):
	data.append(int(angka[i]))
for i in range(len(data) - 1):
	for j in range(i + 1, len(data)):
		if data[i] < data[j]:
			temp = data[i]
			data[i] = data[j]
			data[j] = temp
for i in range(len(data)):
	hasil += data[i]
	koin += 1
	if hasil > rata:
		break
print(koin)


n = int(input())
s = 0
a = sorted([int(x) for x in input().split()])
s = sum(a)
s2 = 0
for i in range(n - 1, -1, -1):
	s2 += a[i]
	if s - s2 < s2:
		print(n - i)
		break


t = int(input())
l = list(map(int, input().split()))
l.sort()
i = t
while i >= 0:
	if sum(l[i:]) <= sum(l[0:i]):
		i -= 1
	else:
		break
print(t - i)


n = int(input())
coins = [int(x) for x in input().split()]
coins = sorted(coins, reverse=True)
if len(coins) == 1:
	print('1')
else:
	for i in range(len(coins)):
		a = coins[0:i + 1]
		b = coins[i + 1:n]
		if sum(a) > sum(b):
			print(i + 1)
			break


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
b = []
while sum(b) <= sum(a):
	b.append(a.pop())
print(len(b))


n = int(input())
arr = [int(i) for i in input().split()]
arr.sort(reverse=True)
s = sum(arr)
s = s / 2
curr = 0
count = 0
for i in range(n):
	if curr + arr[i] <= s:
		curr += arr[i]
	else:
		count = i + 1
		break
print(count)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
cummulative = []
cummulative.append(arr[0])
for i in range(1, n):
	cummulative.append(arr[i] + cummulative[i - 1])
backSum = arr[n - 1]
i = n - 1
while i > 0:
	if backSum > cummulative[i - 1]:
		break
	else:
		backSum = backSum + arr[i - 1]
		i = i - 1
print(n - i)


n = int(input())
coins = list(map(int, input().split()))
coins = sorted(coins)
coin = coins[::-1]
you = 0
twins = sum(coins)
for i in range(0, n):
	you += coin[i]
	twins -= coin[i]
	if you > twins:
		break
print(i + 1)


count_coins = int(input(''))
coins = input('')
total_coins = coins.split(' ')
total_coins = [int(coin) for coin in total_coins]
total_coins = sorted(total_coins, reverse=True)
sum_total = sum(total_coins)
half_total = sum_total / 2
i = 0
sum_new = 0
for coin in total_coins:
	i += 1
	sum_new += coin
	if sum_new > half_total:
		break
print(i)


n = int(input())
a = list(map(int, input().split()))
s = []
i = n - 1
a.sort()
while sum(s) <= sum(a):
	if a:
		s.append(a.pop())
	i -= 1
print(len(s))


n = int(input())
a = [int(a) for a in input().split()]
a.sort(reverse=True)
total = sum(a)
x = []
for i in range(n):
	count = 0
	for b in range(i + 1):
		count = count + a[b]
	if count > total - count:
		x.append(i + 1)
print(min(x))


n = int(input())
summ = 0
ans = 0
ttmp = 0
coins = input().split(' ')
for i in range(0, n):
	coins[i] = int(coins[i])
	summ += coins[i]
coins.sort(reverse=True)
for i in range(0, n):
	ttmp += coins[i]
	ans += 1
	if ttmp * 2 > summ:
		break
print(ans)


Number_of_coins = input()
values_of_coins = input()
values = values_of_coins.split()
for i in range(len(values)):
	values[i] = int(values[i])
values.sort()
count = 0
sum1 = 0
sum2 = 0
for i in range(len(values)):
	sum1 += values[i]
for i in range(-1, -len(values) - 1, -1):
	count += 1
	sum2 += values[i]
	sum1 -= values[i]
	if sum2 > sum1:
		break
print(count)


import math
n = int(input())
coins = [int(a) for a in input().split()]
coins.sort(reverse=True)
sum = sum(coins)
if sum % 2 == 0:
	half = sum / 2 + 1
else:
	half = math.ceil(sum / 2)
me = 0
i = 0
while me < half:
	me += coins[i]
	i += 1
print(i)


def main():
	n = int(input())
	li = list(map(int, input().split()))
	sumt = sum(li)
	tot = 0
	cnt = 0
	li.sort(reverse=True)
	for i in range(n):
		tot = tot + li[i]
		cnt = cnt + 1
		if tot > sumt - tot:
			break
	print(cnt)
main()


x = int(input())
l = list(map(int, input().split()))
l.sort()
s = 0
c = 0
while sum(l) > s:
	s = s + l.pop()
	c = c + 1
if sum(l) == s:
	print(c + 1)
else:
	print(c)


n = int(input())
a = list(input().split(' '))
(sum, rsum) = ([], [])
for i in range(n):
	a[i] = int(a[i])
	rsum.append(0)
a.sort()
sum.append(a[0])
rsum[n - 1] = a[n - 1]
for i in range(1, n):
	sum.append(sum[i - 1] + a[i])
for i in reversed(range(n - 1)):
	rsum[i] = rsum[i + 1] + a[i]
ok = 0
for i in reversed(range(n)):
	if i == 0:
		break
	if rsum[i] > sum[i - 1]:
		print(n - i)
		ok = 1
		break
if ok == 0:
	print(n)


n = int(input())
arr = [int(i) for i in input().split()]
arr.sort(reverse=True)
sum1 = sum(arr)
sum2 = 0
count = 0
for i in arr:
	if sum2 + i <= sum1 - sum2 - i:
		sum2 += i
		count += 1
	else:
		break
print(count + 1)


n = int(input())
list_a = list(map(int, input().split()))
list_a.sort(reverse=True)
list_sum = sum(list_a)
count = 0
my_sum = 0
i = 0
while my_sum <= list_sum / 2:
	count += 1
	my_sum += list_a[i]
	i += 1
print(count)


n = int(input())
li = sorted([int(i) for i in input().split()])
sum1 = 0
sum2 = 10
j = 0
li = li[::-1]
while sum1 <= sum2:
	sum1 += li[j]
	sum2 = sum(li[j + 1:])
	j += 1
print(j)


n = int(input())
arr = [int(elem) for elem in input().split(' ')]
for i in range(n):
	for j in range(n):
		if arr[j] < arr[i]:
			(arr[i], arr[j]) = (arr[j], arr[i])
for i in range(n + 1):
	if sum(arr[:i]) > sum(arr[i:]):
		print(i)
		break


n = int(input())
l = [int(x) for x in input().split(' ')]
s = sum(l)
l = sorted(l)
S = 0
Sum = int(sum(l) / 2)
for i in range(n - 1, -1, -1):
	S += l[i]
	if S > Sum:
		print(n - i)
		break


n = int(input())
a = list(map(int, input().split()))
s = sum(a)
a = sorted(a)
s = s // 2
i = n - 1
ans = 0
count = 0
while i >= 0 and ans <= s:
	ans += a[i]
	count += 1
	i -= 1
print(count)


l = int(input())
m = input()
m = m.split()
z = []
sum = 0
sum1 = 0
j = 0
for i in range(l):
	z.append(m[i])
	sum = int(sum) + int(z[i])
	z[i] = int(z[i])
z.sort(reverse=True)
for i in range(l):
	sum1 = int(sum1) + int(z[i])
	if sum1 <= sum - sum1:
		j = j + 1
	else:
		j = j + 1
		break
print(j)


def solve(nums):
	nums.sort(reverse=True)
	limit = sum(nums) / 2
	total = 0
	cnt = 0
	i = 0
	while i < len(nums):
		total += nums[i]
		cnt += 1
		i += 1
		if total > limit:
			return cnt
	return cnt
N = input()
nums = list(map(int, input().strip().split(' ')))
print(solve(nums))


n = int(input())
l = list(map(int, input().split()))
tot = sum(l)
split = tot / 2
l.sort(reverse=True)
ac_sum = 0
nb_coins = 0
for e in l:
	ac_sum += e
	nb_coins += 1
	if ac_sum > split:
		break
print(nb_coins)


n = int(input())
s = list(map(int, input().split()))
s.sort(reverse=True)
ans = 0
a = 0
while a <= sum(s):
	a += s[0]
	s.pop(0)
	ans += 1
print(ans)


n = int(input())
list_of_coin = sorted(list(map(int, input().split())), reverse=True)
sum_of_coin = sum(list_of_coin)
cumulative = 0
number_coin = 0
for element in list_of_coin:
	cumulative += element
	number_coin += 1
	if cumulative > sum_of_coin / 2:
		break
print(number_coin)


n = int(input())
a = list(map(int, input().split()))
a.sort()
cs = c = 0
while cs <= sum(a):
	cs += a.pop()
	c += 1
print(c)


n = int(input())
list1 = [0] * n
string = input()
s = string.split(' ')
sm = 0
for i in range(n):
	list1[i] = int(s[i])
	sm += list1[i]
for i in range(n):
	j = n - 1
	while j > i:
		if list1[j - 1] < list1[j]:
			p = list1[j - 1]
			list1[j - 1] = list1[j]
			list1[j] = p
		j = j - 1
sm = sm / 2
for i in range(n):
	sm -= list1[i]
	if sm < 0:
		print(i + 1)
		break


n = input()
m = [int(x) for x in input().split(' ')]
total = sum(m)
m.sort()
m = m[::-1]
p = 0
r = 0
for k in range(0, len(m)):
	if p <= total / 2:
		r += 1
		p += m[k]
print(r)


x = int(input())
a = [int(num) for num in input().split()]
a.sort(reverse=True)
d = sum(a)
c = d // 2 + 1
count = 0
sum1 = 0
for i in a:
	sum1 += i
	count += 1
	if sum1 >= c:
		break
print(count)


n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
i = 1
while True:
	if sum(a[:i]) > sum(a[i:]):
		print(len(a[:i]))
		break
	else:
		i += 1


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
s = 0
max = sum(a)
for i in range(len(a)):
	s = s + a[i]
	if s > max / 2:
		print(i + 1)
		break


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
s = sum(l) // 2
t = 0
c = 0
for i in l:
	if not t > s:
		c += 1
		t += i
	else:
		break
print(c)


n = int(input())
l1 = list(map(int, input().split()))
s1 = sum(l1)
s = int(s1 / 2)
count = 0
s2 = 0
while s2 <= s:
	maximum = max(l1)
	for k in range(0, len(l1)):
		if maximum == l1[k]:
			temp = l1.pop(k)
			break
	s2 = s2 + temp
	count = count + 1
print(count)


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


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
twin = sum(a)
sum = 0
c = 0
for i in range(len(a)):
	if sum <= twin:
		c += 1
		sum += a[i]
		twin -= a[i]
print(c)


count = int(input())
arr = list(map(int, input().split()))

def partition(arr, low, high):
	i = low - 1
	pivot = arr[high]
	for j in range(low, high):
		if arr[j] <= pivot:
			i = i + 1
			(arr[i], arr[j]) = (arr[j], arr[i])
	(arr[i + 1], arr[high]) = (arr[high], arr[i + 1])
	return i + 1

def quick_sort(arr, low, high):
	if low < high:
		p_i = partition(arr, low, high)
		quick_sort(arr, low, p_i - 1)
		quick_sort(arr, p_i + 1, high)
n = len(arr)
quick_sort(arr, 0, n - 1)
status = True
my_bags = []
i = 1
while status:
	my_bags.append(arr[n - i])
	n_my_bags = len(my_bags)
	if sum(arr[0:n - i]) < sum(my_bags):
		status = False
	i += 1
print(n_my_bags)


n = int(input())
s = sorted(list(map(int, input().split())))
k = 0
while sum(s[:k + 1]) < sum(s[k + 1:]):
	k += 1
print(n - k)


n = int(input())
c = list(map(int, input().split()))
c.sort(reverse=True)

def coins(c):
	count = 0
	for i in range(n):
		count += c[i]
		if count > sum(c) - count:
			return i + 1
print(coins(c))


n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
s = sum(a)
cur_sum = 0
for (index, val) in enumerate(a, start=1):
	cur_sum += val
	if cur_sum > s - cur_sum:
		print(index)
		break


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(), reverse=True)
	s = sum(a)
	t = 0
	r = 0
	for c in a:
		r += 1
		t += c
		if t > s - t:
			break
	return r
print(main())


n = int(input())
coins = list(map(int, input().split()))
srted = sorted(coins, reverse=True)
total = sum(srted)
batpar = 0
count = 0
for i in srted:
	if batpar <= total / 2:
		batpar += i
		count += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
twin = 0
me = 0
coins = 0
for i in range(len(a)):
	twin += a[i]
while twin >= me:
	twin -= max(a)
	me += max(a)
	a.remove(max(a))
	coins += 1
print(coins)


def prob160A(n, alist):
	alist.sort(reverse=True)
	for i in range(1, n + 1):
		if sum(alist[:i]) > sum(alist[i:]):
			return i
n = int(input())
x = list(map(int, input().strip().split(' ')))
result = prob160A(n, x)
print(result)


inp = int(input())
en = input()
ls1 = en.split()
ls = []
for q in range(inp):
	ls.append(int(ls1[q]))
count = 0
for i in range(len(ls)):
	for x in range(len(ls) - 1 - i):
		if ls[x] < ls[x + 1]:
			(ls[x], ls[x + 1]) = (ls[x + 1], ls[x])
for i in range(len(ls)):
	count = count + ls[i]
count2 = 0
final = 0
for o in range(len(ls)):
	count2 = count2 + ls[o]
	final += 1
	if count2 > count / 2:
		break
print(final)


n = int(input())
l = sorted(map(int, input().split()))
print(n + 1 - min((i for i in range(n + 1) if sum(l[:i]) >= sum(l[i:]))))


num = input('')
prices = input('')
coins = prices.split(' ')
for i in range(int(num)):
	coins[i] = int(coins[i])
coins.sort()
twina = 0
half = 0
count = 0
for i in range(int(num)):
	half += coins[i]
half /= 2
for i in range(int(num) - 1, -1, -1):
	if twina <= half:
		twina += coins[i]
		count += 1
print(count)


n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
s = 0
s1 = 0
k = 0
for i in a:
	s += i
for i in range(n):
	s1 += a[i]
	k += 1
	if s1 > s / 2:
		break
print(k)


a = int(input())
b = input()
list = b.split()
c = len(list)
l = [i for i in range(c)]
SUM = 0
for i in range(c):
	l[i] = list[i]
	l[i] = int(l[i])
	SUM += l[i]
for i in range(c - 1):
	for j in range(i, c - 1):
		if l[c + i - j - 1] > l[c + i - j - 2]:
			rr = l[c + i - j - 1]
			l[c + i - j - 1] = l[c - j + i - 2]
			l[c - j - 2 + i] = rr
S = 0
t = 0
while S <= SUM / 2:
	S += l[t]
	t += 1
print(t)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
margin = sum(arr) / 2
ans = 0
for i in range(1, len(arr) + 1):
	ans += arr[-i]
	if ans > margin:
		print(i)
		break


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
s = 0
c = 0
if n == 1:
	print(1)
elif n == 2:
	if l[1] == l[0]:
		print(2)
	else:
		print(1)
else:
	for i in range(n):
		s = s + l[i]
		s1 = sum(l[i + 1:])
		c = c + 1
		if s > s1:
			break
	print(c)


n = int(input())
num = list(map(int, input().split()))
num.sort(reverse=True)
total = sum(num) / 2
count = 1
res = num[0]
for i in range(n):
	if res > total:
		print(count)
		break
	else:
		res = res + num[i + 1]
		count += 1


a = int(input())
b = list(map(int, input().split()))
b.sort()
s = 0
s1 = 0
ans = 0
for i in range(a):
	s += int(b[i])
s = s / 2
for i in range(a - 1, -1, -1):
	if s < s1:
		break
	else:
		ans += 1
		s1 += int(b[i])
print(ans)


n = int(input())
a = list(map(int, input().split()))
a.sort()
min1 = 1000000007
for i in range(n):
	c = 0
	s = 0
	for j in range(i, n):
		s += a[j]
	for j in range(i):
		c += a[j]
	if s > c:
		min1 = min(min1, n - i)
print(min1)


n = int(input())
v = list(map(int, input().split()))
v.sort()
sum = 0
for i in range(n):
	sum += v[i]
ok = 'true'
i = n - 1
sumax = v[i]
while ok == 'true':
	if sumax > sum - sumax:
		ok = 'false'
	else:
		i -= 1
		sumax += v[i]
print(n - i)


n = int(input())
string = input().split()
length = len(string)
intString = []
summ = int(0)
for i in range(length):
	intString.append(int(string[i]))
sort = sorted(intString)
for i in range(length):
	summ = summ + sort[-(i + 1)]
	if sum(sort[:-(i + 1)]) < summ:
		print(i + 1)
		break


n = int(input())
m = input().split()
jumlah = 0
for i in range(n - 1):
	for j in range(i + 1, n):
		if int(m[i]) < int(m[j]):
			temp = m[i]
			m[i] = m[j]
			m[j] = temp
k = 0
for i in range(n):
	jml = 0
	for j in range(i + 1, n):
		jml += int(m[j])
	if int(m[i]) + k > jml:
		jumlah += 1
		break
	else:
		jumlah += 1
		k += int(m[i])
print(jumlah)


def main():
	inp1 = int(input())
	inp2 = input().split()
	L = []
	c = 0
	for i in inp2:
		L.append(int(i))
	L.sort(reverse=True)
	Sum = sum(L)
	for j in range(inp1):
		c += L[j]
		if c > Sum - c:
			break
	print(j + 1)
main()


n = int(input())
coins = sorted(map(int, input().split()))
coins.reverse()
all_coins = sum(coins)
me = 0
for (i, c) in enumerate(coins):
	me += c
	if me > all_coins * 0.5:
		print(i + 1)
		break


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
a = a[::-1]
su = sum(a)
s = 0
c = 1
for j in range(n):
	s = s + a[j]
	if s > su - s:
		break
	else:
		c += 1
print(c)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
aSum = a[0]
a.remove(a[0])
c = 1
while aSum <= sum(a):
	c += 1
	aSum += a[0]
	a.remove(a[0])
print(c)


n = int(input())
l = []
l.append(input().split())
mylist = [i for item in l for i in item]
mylist = sorted(list(map(int, mylist)), reverse=True)
if n == 1:
	print(1)
elif mylist[0] > sum(mylist[1:]):
	print(1)
else:
	for i in range(0, n):
		sum1 = sum(mylist[0:i + 1])
		sum2 = sum(mylist[i + 1:])
		if sum1 > sum2:
			print(i + 1)
			break
		elif sum1 == sum2:
			print(i + 2)
			break


n = int(input())
a = input().split()
sum = 0
for i in range(n):
	a[i] = int(a[i])
	sum += a[i]
a.sort(reverse=True)
count = 0
take = 0
for i in range(n):
	take += a[i]
	sum -= a[i]
	count += 1
	if take > sum:
		print(count)
		break


case = int(input())
l = sorted(list(map(int, input().strip().split())))
a = 0
b = sum(l)
c = 0
for i in range(len(l) - 1, -1, -1):
	if a > b:
		break
	a += l[i]
	b -= l[i]
	c += 1
print(c)


num = int(input())
coins = list(map(int, input().split()))
coins.sort()
max = sum(coins)
ans = max // 2
count = 0
check = 0
for i in range(num - 1, -1, -1):
	check += coins[i]
	count += 1
	if check > ans:
		print(count)
		break


n = int(input())
L = [int(x) for x in input().split()]
for i in range(n - 1):
	for j in range(i + 1, n):
		if L[i] > L[j]:
			temp = L[i]
			L[i] = L[j]
			L[j] = temp
Count = 0
Sum = 0
while Sum <= sum(L):
	Sum += L.pop()
	Count += 1
print(Count)


def twinsTwins(lst):
	lstSort = sorted(lst)
	sum = 0
	count1 = 0
	countFinal = 0
	for i in lstSort:
		sum += i
	for i in lstSort[::-1]:
		count1 += i
		countFinal += 1
		if count1 > sum / 2:
			break
	return countFinal
n = input()
lst1 = list(map(int, input().split(' ')))
print(twinsTwins(lst1))


n = int(input())
a = input().split()
e = []
s = []
for i in a:
	i = int(i)
	e.append(i)
	s.append(i)
x = 0
e.sort()
for i in range(1, 1 + n):
	x += max(e)
	e.pop()
	if x > sum(s) / 2:
		print(i)
		break


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


n = int(input())
arr = list((int(a) for a in input().split(' ')))
arr = sorted(arr, reverse=True)
for i in range(len(arr) + 1):
	arr1 = arr[:i]
	arr2 = arr[i:]
	sum1 = sum(arr1)
	sum2 = sum(arr2)
	if sum1 > sum2:
		print(i)
		break


n = int(input())
coins = list(map(int, input().split()))
coins.sort()
pre = [0]
(ans, count) = (0, 0)
for i in range(len(coins) - 1):
	ans += coins[i]
	pre.append(ans)
v = 0
for j in range(len(coins) - 1, -1, -1):
	count += 1
	v += coins[j]
	if v > pre[j]:
		break
print(count)


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


n = int(input())
coins = sorted([int(s) for s in input().split()])
s = sum(coins)
c1 = 0
s1 = 0
for c in reversed(coins):
	if s1 > s - s1:
		break
	else:
		c1 += 1
		s1 += c
print(c1)


n = int(input())
lst = sorted(list(map(int, input().split())), reverse=True)
i = 1
while i < n:
	if sum(lst[:i]) > sum(lst[i:]):
		break
	i += 1
print(i)


n = int(input())
w = [int(x) for x in input().split()]
(p, su, cnt) = (0, 0, 0)
while p == 0:
	ma = max(w)
	su += ma
	cnt += 1
	w.remove(ma)
	if su > sum(w):
		p = 1
		print(cnt)


i = input()
L = list(map(int, input().split()))
L.sort()
half = sum(L) / 2
partsum = 0
count = 0
while partsum <= half:
	partsum += L.pop()
	count += 1
print(count)


n = int(input())
inp = sorted(list(map(int, input().split())))
my_sum = 0
cntr = 0
for i in range(n):
	if my_sum <= sum(inp):
		my_sum += inp.pop()
		cntr += 1
print(cntr)


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


n = int(input())
k = list(map(int, input().split()))
k = sorted(k, reverse=True)
if n > 1:
	s = 0
	for i in k:
		s = s + int(i)
	d = 0
	h = []
	for i in range(len(k)):
		d = d + int(k[i])
		if d > s / 2:
			h.append(k[:i + 1])
			break
	print(len(h[0]))
if n == 1:
	print(1)


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


n = int(input())
arr = [int(i) for i in input().split()]
arr.sort(reverse=True)
total = sum(arr)
s1 = 0
for i in range(n):
	s1 += arr[i]
	if s1 > total - s1:
		print(i + 1)
		break


n = int(input())
l = list(map(int, input().split()))
l.sort()
count = 0
tempsum = 0
j = n - 1
while j >= 0:
	if l[j] + tempsum > sum(l) - (l[j] + tempsum):
		count += 1
		break
	else:
		tempsum += l[j]
		j -= 1
		count += 1
print(count)


(n, a) = (int(input()), sorted(map(int, input().split()), reverse=True))
(temp_sum, count) = (a[0], 1)
for i in range(1, n):
	if temp_sum > sum(a) // 2:
		break
	else:
		temp_sum += a[i]
		count += 1
print(count)


(n, m) = (int(input()), input().split())
m = sorted([int(i) for i in m], reverse=True)
limit = sum(m) / 2
twin1 = 0
index = 0
while not twin1 > limit:
	twin1 = twin1 + m[index]
	index += 1
print(index)


n = int(input())
a = list(map(int, input().split()))
half = sum(a) / 2
a = sorted(a, reverse=True)
c_money = 0
c_piece = 0
for e in a:
	if c_money > half:
		break
	else:
		c_piece += 1
		c_money += e
print(c_piece)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
s = sum(a)
(x, y) = (0, 0)
while y < n and x <= s - x:
	x += a[y]
	y += 1
print(y)


import sys

class Scanner:

	def __init__(self):
		self.current_tokens = []

	def remaining_tokens(self):
		return len(self.current_tokens)

	def nextline(self):
		assert self.remaining_tokens() == 0, 'Reading next line with remaining tokens'
		return input()

	def nexttokens(self):
		return self.nextline().split()

	def nexttoken(self):
		if len(self.current_tokens) == 0:
			self.current_tokens = self.nexttokens()
		assert self.remaining_tokens() > 0, 'Not enough tokens to parse.'
		return self.current_tokens.pop(0)

	def nextints(self, n=-1):
		if n == -1:
			return list(map(int, self.nexttokens()))
		else:
			return (self.nextint() for i in range(n))

	def nextint(self):
		return int(self.nexttoken())

def quit():
	sys.exit(0)
stdin = Scanner()
nextint = stdin.nextint
nextints = stdin.nextints
nextline = stdin.nextline
n = nextint()
s = 0
a = []
for i in range(n):
	j = nextint()
	a.append(j)
	s += j
a = sorted(a, reverse=True)
t = s // 2
c = 0
i = 0
while c <= t:
	(c, i) = (c + a[i], i + 1)
print(i)


input1 = input('')
input2 = input('')
input2 = input2.split(' ')
for i in range(len(input2)):
	input2[i] = int(input2[i])
input2.sort()
total = sum(input2)
sum = 0
coins = 0
i = len(input2) - 1
while sum <= total - sum:
	sum += input2[i]
	coins += 1
	i -= 1
print(coins)


n = int(input())
moedas = list(map(int, input().split()))
moedas.sort(reverse=True)
t = sum(moedas) / 2
cont = 0
soma = 0
for i in moedas:
	soma += i
	cont += 1
	if soma > t:
		print(cont)
		break


n = int(input())
a = [int(x) for x in input().split(' ')]
a.sort(reverse=True)
s = sum(a)
ct = 0
x = n
for i in range(n):
	ct += a[i]
	s -= a[i]
	if ct > s:
		x = i + 1
		break
print(x)


n = int(input())
l = [int(x) for x in input().split()]
l = sorted(l)
cnt = 0
s = sum(l)
c = 0
for i in l[::-1]:
	c += i
	cnt += 1
	if c > s / 2:
		break
print(cnt)


n = int(input())
coins = map(int, input().split())
c = sorted(coins, reverse=True)
s = sum(c)
d = 0
i = 0
for j in c:
	d += j
	i += 1
	if d > s - d:
		print(i)
		exit()


def fd70000000():
	n = int(input())
	s = list(map(int, input().split()))
	s = sorted(s, reverse=True)
	for i in range(len(s)):
		if sum(s[:i]) > sum(s[i:]):
			return print(i)
	return print(n)
fd70000000()


n = int(input())
a = input().split()
for w in range(len(a)):
	a[w] = int(a[w])
a.sort(reverse=True)
count = 0
count2 = 0
for c in range(len(a)):
	count += a[c]
	count2 += 1
	if count > sum(a[c + 1:]):
		break
print(count2)


n = int(input())
x = input()
y = x.split()
for i in range(0, len(y)):
	y[i] = int(y[i])
s = sum(y)
y = sorted(y)
y.reverse()
if y[0] > s - y[0]:
	print(1)
else:
	for j in range(1, len(y) + 1):
		f = sum(y[0:j])
		if f > s - f:
			print(j)
			break


n = int(input())
data = [int(x) for x in input().split()]
data.sort(reverse=True)
ans = 0
pivot = sum(data) // 2
curr = 0
for q in data:
	if curr > pivot:
		break
	else:
		curr += q
		ans += 1
print(ans)


n = int(input())
in_string = input().split(' ')
arr = [int(x) for x in in_string]
arr.sort(reverse=True)
total = 0
for i in range(0, len(arr)):
	x = arr[i]
	total += x
sum = 0
i = 0
while total >= sum:
	sum += arr[i]
	total -= arr[i]
	i += 1
print(i)


m = input()
t = [int(x) for x in input().split()]
t.sort(reverse=True)
s = 0
count = 0
for i in t:
	s += i
	count += 1
	if s > sum(t) / 2:
		break
print(count)


n = int(input())
v = list(map(int, input().split()))
v.sort()
v.reverse()
(s, ite, s2) = (0, 0, sum(v))
for i in v:
	s += i
	ite += 1
	s2 -= i
	if s > s2:
		break
print(ite)


n = int(input())
coinValues = [int(x) for x in input().split()]
coinValues = sorted(coinValues)
coinValues.reverse()
baseCoin = sum(coinValues) / 2
a1 = 0
overall = 0
for i in range(len(coinValues)):
	if a1 > baseCoin:
		break
	a1 += coinValues[i]
	overall += 1
print(overall)


n = int(input())
c = list((int(a) for a in input().split()))
c.sort(reverse=True)
s = sum(c)
cnt = 0
ms = 0
while ms <= s / 2:
	ms += c[cnt]
	cnt += 1
print(cnt)


(n, a) = (int(input()), list(map(int, input().split())))
a.sort(reverse=True)
avg = sum(a) / 2
(count, ocoin) = (0, 0)
for x in a:
	ocoin += x
	count += 1
	if ocoin > avg:
		break
print(count)


n = int(input())
coins = list(map(int, input().split()))
coins.sort()
coins.reverse()
halfway = sum(coins) / 2
totalCoins = 0
curTotal = 0
while curTotal <= halfway:
	curTotal += coins.pop(0)
	totalCoins += 1
print(totalCoins)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
average = sum(a) // 2
take = 0
count = 0
for i in a:
	take += i
	count += 1
	if take > average:
		break
print(count)


n = input()
n = int(n)
l = input()
arr = list(map(int, l.split(' ')))
arr.sort()
ss = sum(arr)
s = 0
c = 0
for i in range(n - 1, -1, -1):
	s = s + arr[i]
	l = ss - s
	c = c + 1
	if s > l:
		break
print(c)


n = int(input())
a = [int(n1) for n1 in input().split()]
a = sorted(a, reverse=True)
sum1 = 0
for i in range(len(a)):
	if sum(a[:i + 1]) > sum(a[i + 1:]):
		break
print(i + 1)


number = int(input())
value = list(map(int, input().split()))
money = sum(value)
value_as = sorted(value, reverse=True)
if money % 2 == 0:
	half = money / 2 + 1
else:
	half = (money + 1) / 2
i = 0
take = 0
none = True
while none:
	take += value_as[i]
	i += 1
	if take >= half:
		print(i)
		none = False


n = int(input())
coins = input().split()
for i in range(n):
	coins[i] = int(coins[i])
coins.sort()
total = 0
taken = 0
left = 0
for i in range(n):
	coin = coins.pop(n - 1 - i)
	total += coin
	taken += 1
	for j in coins:
		left += j
	if total > left:
		break
	left = 0
print(taken)


n = int(input())
a = map(int, input().split())
a = list(a)
gemini = []
for i in range(n):
	gemini.append(max(a))
	a.remove(max(a))
	if sum(gemini) > sum(a):
		break
print(len(gemini))


test = int(input())
coins = [int(c) for c in input().split()]
total = sum(coins) / 2
coins.sort(reverse=True)
acum = 0
res = 0
for i in coins:
	acum += i
	res += 1
	if acum > total:
		break
print(res)


def getIndexMaxNumber(listNumber):
	maxIndex = 0
	for i in range(1, len(listNumber)):
		if listNumber[i] > listNumber[maxIndex]:
			maxIndex = i
	return maxIndex

def getIndexLessNumber(listNumber):
	lessIndex = 0
	for i in range(1, len(listNumber)):
		if listNumber[i] < listNumber[lessIndex]:
			lessIndex = i
	return lessIndex

def sumCoins(listCoins):
	sum = 0
	for i in range(0, len(listCoins)):
		sum += listCoins[i]
	return sum
numCoins = int(input())
coins = list(map(int, input().split()))
myCoins = []
broCoins = []
currentIndex = 0
for i in range(numCoins):
	maxCoinIndex = getIndexMaxNumber(coins)
	lessCoinIndex = getIndexLessNumber(coins)
	if sumCoins(myCoins) <= sumCoins(broCoins) + coins[maxCoinIndex]:
		myCoins.append(coins[maxCoinIndex])
		del coins[maxCoinIndex]
	else:
		broCoins.append(coins[lessCoinIndex])
		del coins[lessCoinIndex]
print(len(myCoins))


n = int(input())
f = lambda : list(map(int, list(input().split())))
a = f()
a.sort()
a.reverse()
b = sum(a) / 2
s = 0
e = 0
for i in range(1, n + 1):
	s += a[i - 1]
	if s > b:
		e = i
		break
print(e)


coins = input()
values = list(reversed(sorted((int(x) for x in input().split()))))
values.append(0)
for i in range(len(values)):
	if sum(values[:i]) > sum(values[i:]):
		print(i)
		break


n = int(input())
li = sorted(list(map(int, input().split())))
s = 0
i = 0
while s <= sum(li) // 2:
	i = i - 1
	s = s + li[i]
print(abs(i))


n = int(input())
l = list(map(int, input().split(' ')))
l.sort(reverse=True)
b = sum(l)
a = 0
for i in range(len(l)):
	c = l[i]
	a += c
	b -= c
	if a > b:
		print(i + 1)
		break


n = int(input())
a = list(map(int, input().split()))
b = sum(a) // 2 + 1
c = 0
count = 0
a.sort()
for i in range(len(a)):
	if c >= b:
		break
	else:
		c += a[len(a) - i - 1]
		count += 1
print(count)


n = int(input())
moedas = list(map(int, input().split()))
moedas.sort(reverse=True)
total = 0
for moeda in moedas:
	total += moeda
maiorParte = 0
moedasNecessarias = 0
for moeda in moedas:
	maiorParte += moeda
	moedasNecessarias += 1
	if maiorParte > total / 2:
		break
print(moedasNecessarias)


def split_coin():
	weight = sorted(seq)[::-1]
	total_amt = sum(seq)
	taken = 0
	left = total_amt
	i = 0
	while taken <= left and i < len(weight):
		taken += weight[i]
		left = left - weight[i]
		i += 1
	return i
total_coin = int(input())
seq = list(map(int, input().split()))
print(split_coin())


coins = int(input())
coinValue = []
bigBro = [0]
coinValue = list(map(int, input().split()))
while sum(bigBro) <= sum(coinValue):
	bigBro.append(coinValue.pop(coinValue.index(max(coinValue))))
print(len(bigBro) - 1)


a = int(input())
l = list(map(int, input().split()))[:a]
l.sort()
b = 0
c = 0
n = 0
for i in l:
	b += i
for i in l[::-1]:
	c += i
	n += 1
	if c > b / 2:
		break
print(n)


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
new_sum = 0
i = 0
while new_sum <= sum(coins) / 2:
	new_sum += coins[i]
	i += 1
print(i)


n = int(input())
coins = [int(i) for i in input().split()]
fq = 101 * [0]
nSum = 0
for i in range(n):
	nSum += coins[i]
	fq[int(coins[i])] += 1
avg = nSum // 2
n_coin = 0
value_n_coin = 0
stop_value = 0
for value in range(100, 0, -1):
	if fq[value] == 0:
		continue
	if fq[value] * value + value_n_coin > avg:
		stop_value = value
		break
	value_n_coin += fq[value] * value
	n_coin += fq[value]
for i in range(1, fq[stop_value] + 1):
	if i * stop_value + value_n_coin > avg:
		n_coin += i
		break
print(n_coin)


z = int(input())
coins_list = [int(x) for x in input().split()]
sorteed_coins_list = sorted(coins_list[::-1])
sorted_coins_list_revresed = sorteed_coins_list[::-1]
sum_list = sum(coins_list)
half_sum = sum_list / 2
total = sorted_coins_list_revresed[0]
count = 1
for i in range(z - 1):
	if half_sum >= total:
		count = count + 1
		total = total + sorted_coins_list_revresed[i + 1]
print(count)


from sys import stdin, stdout, stderr
import sys
readints = lambda : [int(x) for x in stdin.readline().split()]
fastwrite = lambda s: stdout.write(str(s) + '\n')
fasterr = lambda s: stderr.write(str(s) + '\n')
irange = lambda x, y: range(x, y + 1)
(n,) = readints()
a = readints()
a.sort(reverse=True)
x = 0
y = sum(a)
res = 0
for i in range(n):
	x += a[i]
	y -= a[i]
	if x > y:
		res = i + 1
		break
fastwrite(res)


from functools import reduce
numberOfCoins = int(input())
coins = [int(x) for x in input().split()]
coins.sort()
coins.reverse()
summition = reduce(lambda x, y: x + y, coins)
mySummition = 0
coinsNumber = 0
for coin in coins:
	if mySummition > summition / 2:
		break
	else:
		mySummition = mySummition + coin
		coinsNumber += 1
print(coinsNumber)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
tot = sum(a)
res = count = 0
for i in a:
	res += i
	count += 1
	if res > tot / 2:
		break
print(count)


input()
a = sorted(map(int, input().split()))
ssum = count = 0
while ssum <= sum(a):
	ssum += a.pop()
	count += 1
print(count)


n = int(input())
l = list(map(int, input().split()))
l.sort()
l.reverse()
x = 0
i = 0
c = 0
while x <= sum(l):
	x = x + l[i]
	c = c + 1
	l.remove(l[i])
print(c)


a = int(input())
b = 0
c = 0
d = 0
A = [int(i) for i in input().split()]
for i in A:
	b += i
A = reversed(sorted(A))
for i in A:
	if c <= b // 2:
		c += i
		d += 1
print(d)


n = int(input())
li = list(map(int, input().split()))
li.sort(reverse=True)
total = 0
for i in range(len(li)):
	total += li[i]
l1 = []
for i in range(1, len(li) + 1):
	s = 0
	for j in range(i):
		s += li[j]
		if s > total - s:
			l1.append(i)
print(min(l1))


n = int(input())
coin = [int(x) for x in input().split()]
limit = float(sum(coin) / 2)
money = 0
count = 0
for i in range(n):
	if money > limit:
		break
	else:
		money += max(coin)
		count += 1
		coin.remove(max(coin))
print(count)


n = int(input())
list = input().split()
a = 0
b = 0
for i in range(n):
	list[i] = int(list[i])
list.sort()
list.reverse()
for i in range(n):
	a += list[i]
	b = 0
	for j in range(i + 1, n):
		b += list[j]
	if a > b:
		print(i + 1)
		break
	else:
		pass


x = int(input())
s = input().split()
s = [int(s[i]) for i in range(x)]
s.sort()
s.reverse()
a = 0
for i in range(x):
	a = a + s[i]
	if 2 * a > sum(s):
		print(i + 1)
		break


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


def get():
	return [int(x) for x in input().split()]
input()
l = get()
l.sort(reverse=True)
(now, s) = (0, sum(l))
for (i, x) in enumerate(l):
	now += x
	if 2 * now > s:
		break
print(i + 1)


n = int(input())
array = list(map(int, input().strip().split()))[:n]
array = sorted(array)
c = sum(array[:n])
c1 = 0
for i in range(len(array) - 1, -1, -1):
	c1 += array[i]
	if c1 > c // 2:
		print(len(array) - i)
		break


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
a = sum(l)
s = 0
count = 0
for e in l:
	s += e
	count += 1
	if s > a // 2:
		break
print(count)


n = int(input())
a = list(map(int, input().split()))
b = []
a = sorted(a, reverse=True)
count = 0
while sum(b) <= sum(a):
	b.append(a[0])
	a = a[1:]
	count += 1
print(count)


input()
l = list(map(int, input().split()))
s = sum(l)
co = 0
ans = 0
l = sorted(l)
for i in l[::-1]:
	co += i
	ans += 1
	if co > s / 2:
		break
print(ans)


input()
coins = [int(i) for i in input().split()]
coins.sort(reverse=True)
total = sum(coins)
first_sum = 0
for i in range(len(coins)):
	first_sum += coins[i]
	if first_sum > total - first_sum:
		print(i + 1)
		break


n = int(input())
l = sorted(list(map(int, input().split())))
(ans, s) = (0, 0)
l = l[::-1]
for i in range(len(l)):
	s += l[i]
	ans += 1
	k = l[i + 1:]
	if s > sum(k):
		print(ans)
		break


import itertools as it
n = input()
coins = list(map(int, input().split()))
coins.sort(reverse=True)
half_val = sum(coins) / 2
total = 1
for sm in it.accumulate(coins):
	if sm <= half_val:
		total += 1
print(total)


a = input()
b = sorted(list(map(int, input().split())))[::-1]
(me, him) = (0, sum(b))
count = 0
while me <= him:
	if len(b) == 1 and me > him:
		break
	p = b.pop(0)
	me += p
	him -= p
	count += 1
print(count)


n = int(input())
z = list(map(int, input().split()))
z.sort()
kiri = 0
kanan = 0
count = 0
for i in range(n):
	kiri += z[i]
y = n - 1
while kiri >= kanan:
	kiri -= z[y]
	kanan += z[y]
	count += 1
	y -= 1
print(count)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
chislo = 0
count = 0
summa = sum(a) / 2
for i in range(len(a)):
	chislo += a[i]
	count += 1
	if chislo > summa:
		print(count)
		break


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)

def split(a, b):
	middle = a + (b - a) // 2
	if a == b:
		return a
	if sum(coins[:middle + 1]) > sum(coins[middle + 1:]):
		return split(a, middle)
	else:
		return split(middle + 1, b)
idx = split(0, len(coins) - 1)
print(len(coins[:idx + 1]))


n = int(input())
a = list(map(int, input().split()))
a.sort()
tmp = 0
count = 0
sum1 = sum(a)
while sum1 >= tmp:
	sum1 -= a[-1]
	tmp += a[-1]
	a.remove(a[-1])
	count += 1
print(count)


(n, L) = (int(input()), sorted(map(int, input().split()), reverse=True) + [0])
for i in range(1, n + 1):
	if sum(L[0:i]) > sum(L[i:]):
		print(i)
		break


el = int(input())
ar = []
for i in input().split(' '):
	ar.append(int(i))
ar.sort()
mid = sum(ar) / 2
count = 0
curr = 0
for i in reversed(range(0, len(ar))):
	count = count + 1
	curr = curr + ar[i]
	if curr > mid:
		break
print(count)


from itertools import accumulate
n = int(input())
x = [int(x) for x in input().split()]
x.sort(reverse=True)
x = list(accumulate(x))
print([i + 1 for (i, a) in enumerate(x) if a > x[-1] - a][0])


from time import process_time
from sys import argv

def solve():
	_ = input()
	a = [int(n) for n in input().split()]
	a.sort(key=lambda x: -x)
	s = sum(a)
	(ans, cur) = (0, 0)
	for v in a:
		(ans, cur) = (ans + 1, cur + v)
		if cur > s // 2:
			break
	print(ans)
if len(argv) > 1:
	startTime = process_time()
	solve()
	print('Elapsed Time:', process_time() - startTime)
else:
	solve()


n = int(input())
l = list(map(int, input().split()))
sum1 = 0
while sum1 <= sum(l):
	sum1 += max(l)
	l.remove(max(l))
print(n - len(l))


n = int(input())
x = []
for i in range(0, n):
	x.append(0)
x = input().split()
for i in range(0, n):
	x[i] = int(x[i])
t = sum(x)
for i in range(0, n):
	for j in range(i, n):
		if x[i] < x[j]:
			(x[i], x[j]) = (x[j], x[i])
c = 0
s = 0
for i in range(0, n):
	s += x[i]
	c += 1
	if s > t / 2:
		break
print(c)


from functools import reduce
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
s = reduce(lambda x, y: x + y, a)
t = 0
i = 0
while t <= s:
	t += a[i]
	s -= a[i]
	i += 1
print(i)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
s1 = 0
s2 = 0
for i in range(len(a)):
	s1 += a[i]
	s2 = sum(a[i + 1:])
	if s1 > s2:
		print(i + 1)
		break


n = int(input())
L = list(map(int, input().split()))
L = sorted(L, reverse=True)
coins = 1
while sum(L[:coins]) <= sum(L[coins:]):
	coins += 1
print(coins)


n = int(input())
s = input().split()
sumTotal = 0
s2 = []
for i in s:
	s2.append(int(i))
for i in s2:
	sumTotal += i
x = 0
sum = 0
s2.sort(reverse=True)
while x < len(s2) and sum <= sumTotal / 2:
	sum += int(s2[x])
	x += 1
print(x)


s = ''

def func(l1):
	st = ''
	l1.sort(reverse=True)
	s = sum(l1)
	(c, k) = (0, 0)
	for i in range(len(l1)):
		if k > s / 2:
			break
		k += l1[i]
		c += 1
	return c
n = int(input())
l1 = list(map(int, input().split()))
print(func(l1))


n = int(input())
coins = list(map(lambda x: int(x), input().split(' ')))
coins.sort()
my_sum = 0
ncoins = 0
total = sum(coins)
mark = True
for i in range(len(coins) - 1, -1, -1):
	val = coins[i]
	my_sum += val
	ncoins += 1
	if my_sum > total // 2:
		mark = False
		print(ncoins)
		break
if mark:
	print(ncoins)


n = int(input())
coins = []
temp = input().split()
for i in range(n):
	coins.append(int(temp[i]))
coins.sort(reverse=True)
total_value = 0
for i in coins:
	total_value += int(i)
(taken, count) = (0, 0)
for i in coins:
	if taken > total_value // 2:
		break
	taken += int(i)
	count += 1
print(count)


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


n = int(input())
arr = list(map(int, input().split()))
list = sorted(arr)
sum = sum(list)
temp = 0
count = 0
j = len(list)
for i in range(n):
	sum = sum - list[j - 1]
	count += 1
	temp = temp + list[j - 1]
	if temp > sum:
		break
	j -= 1
print(count)


n = int(input())
lst = sorted(list(map(int, input().split())), reverse=True)
summa = sum(lst)
summa1 = 0
for i in range(n):
	summa1 += lst[i]
	summa -= lst[i]
	if summa1 > summa:
		print(i + 1, end=' ')
		break


n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
s = sum(a)
(b, k) = (0, 0)
for i in a:
	if s - b < b:
		break
	b = b + i
	k += 1
print(k)


a = int(input())
n = sorted(list(map(int, input().split())))
v = 0
s = 0
for i in range(len(n)):
	v += n[-1]
	n.pop(-1)
	s += 1
	if v > sum(n):
		break
print(s)


n = int(input())
a = list(map(int, input().split()))
s = sum(a)
a.sort()
a.reverse()
ans = 0
cur = 0
for i in a:
	if cur <= s / 2:
		cur += i
		ans += 1
	else:
		break
print(ans)


n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
if n == 1:
	print('1')
elif n == 2 and len(set(a)) == len(a):
	print('1')
elif n == 2 and len(set(a)) != len(a):
	print('2')
else:
	for i in range(1, n):
		if sum(a[0:i]) > sum(a[i:]):
			print(i)
			break


n = int(input())
a = list(map(int, input().split()))
total = sum(a)
coins = 0
total_so_far = 0
for c in sorted(a)[::-1]:
	total_so_far += c
	coins += 1
	if total_so_far > total - total_so_far:
		break
print(coins)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
a.reverse()
for i in range(n):
	if sum(a[:i + 1]) > sum(a[i + 1:]):
		print(i + 1)
		break


from math import floor
n = int(input())
coins = [int(x) for x in input().split()]
net = sum(coins)
coins.sort()
coins = coins[::-1]
netsum = 0
count = 0
for i in coins:
	netsum += i
	count += 1
	if netsum > floor(net / 2):
		break
print(count)


n = int(input())
arr = list(map(int, input().split()))
count = 1
arr = sorted(arr, reverse=True)
total = sum(arr)
m = 0
for i in range(n):
	m += arr[i]
	if m > total - m:
		break
	else:
		count += 1
print(count)


def func():
	ctr = int(input())
	user = input().split()
	for i in range(len(user)):
		user[i] = int(user[i])
	user.sort(reverse=True)
	sum = 0
	sum_left = 0
	for i in user:
		sum = sum + i
	for i in range(len(user)):
		sum_left = sum_left + user[i]
		if sum_left > sum - sum_left:
			print(i + 1)
			break
func()


n = int(input())
L = list(map(int, input().split()))
L = list(reversed(sorted(L)))
k = L[0]
i = 1
s = sum(L) - L[0]
while k <= s:
	k = k + L[i]
	s = s - L[i]
	i = i + 1
print(i)


n = int(input())
lim = list(map(int, input().split()))
lim.sort(reverse=True)
k = 1
for i in range(len(lim)):
	if sum(lim[:i + 1]) <= sum(lim[i + 1:]):
		k = k + 1
	else:
		break
print(k)


n = int(input())
mas = list(map(int, input().split()))
sm = 0
for i in range(0, len(mas)):
	sm += mas[i]
cur = 0
cnt = 0
while cur <= sm // 2:
	a = max(mas)
	cur += a
	mas.remove(a)
	cnt += 1
print(cnt)


n = int(input())
l = list(map(int, input().split(' ')))
l.sort()
s = sum(l) / 2
x = 0
su = 0
i = n - 1
while su <= s:
	su += l[i]
	x += 1
	i -= 1
print(x)


n = int(input())
l = [int(i) for i in input().split()]
ls = sorted(l)
s0 = sum(l) / 2
s = 0
for i in range(n):
	s += ls[i]
	if s >= s0:
		print(n - i)
		break


n = int(input())
a = list(map(int, input().split()))
a.sort()
sum = sum(a)
cnt = 0
s = 0
while s <= sum // 2:
	cnt += 1
	s += a[n - cnt]
print(cnt)


numCoins = int(input())
coins = [int(i) for i in input().split()]
coins.sort(reverse=True)
nec = sum(coins) / 2
total = 0
ind = 0
while total <= nec:
	total += coins[ind]
	ind += 1
print(str(ind))


input()
aa = sorted(map(int, input().split(' ')), reverse=True)
h = sum(aa) / 2
c = 0
for (i, a) in enumerate(aa):
	c += a
	if c > h:
		print(i + 1)
		break


_ = input()
a = [int(i) for i in input().split()]
a.sort(reverse=True)
for i in range(len(a) + 1):
	if sum(a[:i]) > sum(a[i:]):
		print(i)
		break


n = int(input())
a = list(map(int, input().split()))
s = sum(a)
s = s // 2
a.sort()
l = 0
a1 = 0
for i in range(len(a) - 1, -1, -1):
	l = l + 1
	a1 = a1 + a[i]
	if a1 > s:
		break
print(l)


def insertSort(list):
	for i in range(1, len(list)):
		j = i
		while j > 0 and list[j - 1] > list[i]:
			j -= 1
		list.insert(j, list[i])
		list.pop(i + 1)
	list.reverse()
	return list
number = int(input())
list = list(map(int, input().split()))
list = insertSort(list)
sum_front = sum_left = 0
sum_total = sum(list)
count = 0
for i in list:
	sum_front += i
	sum_left = sum_total - sum_front
	count += 1
	if sum_front > sum_left:
		break
print(count)


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


n = int(input())
m = list(map(int, input().split()))
m.sort()
j = 0
k = 0
for i in range(n - 1, -1, -1):
	j += 1
	k += m[i]
	if k > sum(m) / 2:
		print(j)
		break


n = int(input())
l = list(map(int, input().split(' ')))
l.sort(reverse=True)
count = 0
maxi = 0
total = 0
for i in range(0, n):
	total += l[i]
	if maxi <= total:
		total -= l[count]
		maxi += l[count]
		count += 1
print(count)


n = int(input())
coins = [int(i) for i in input().split()]
coins_sorted = [9999]
for i in range(n):
	value = coins[i]
	index = 0
	while coins_sorted[index] < value:
		index += 1
	coins_sorted.insert(index, value)
coins_sorted = coins_sorted[:-1]
coins_sorted.reverse()
total = sum(coins_sorted)
partial_sum = 0
num_coins = 0
while 2 * partial_sum <= total:
	partial_sum += coins_sorted[num_coins]
	num_coins += 1
print(num_coins)


n = int(input())
a = list(map(int, input('').split()))[:n]
a.sort(reverse=True)
taka = 0
coins = 0
for i in range(n):
	taka = taka + a[i]
	coins += 1
	remain = sum(a) - taka
	if taka > remain:
		break
print(coins)


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


input()
x = list(map(int, input().split()))
a = 0
count = 0
z = sum(x) / 2
x.sort(reverse=True)
for i in x:
	if a > z:
		print(count)
		break
	else:
		a += i
		count += 1
else:
	print(count)


num = int(input())
sequence = input()
lst_coins = list(map(int, sequence.split()))
lst_coins = sorted(lst_coins, reverse=True)
total_val = sum(lst_coins)
summ = 0
count = 0
for i in lst_coins:
	summ += i
	count += 1
	if summ > total_val - summ:
		break
print(count)


a = int(input())
x = list(map(int, input().split()))
s = 0
sum1 = 0
j = 0
c = 0
sh = 0
x.sort()
for i in range(len(x)):
	s += x[i]
sum1 = s // 2
while j <= sum1:
	c += 1
	j += x[a - c]
print(c)


n = int(input())
A = sorted(list(map(int, input().split())))
(S, s) = (sum(A), 0)
i = 0
A.reverse()
while i < n:
	s += A[i]
	S -= A[i]
	if s > S:
		break
	i += 1
print(i + 1)


def int_array():
	return [int(x) for x in input().split()]
c = int(input())
n = int_array()
m = 0
for i in range(c):
	m += n[i]
n = sorted(n, reverse=True)
half = m / 2
coin_count = 0
coin_sum = 0
for i in n:
	coin_count += 1
	coin_sum += i
	if coin_sum > half:
		break
print(coin_count)


n = input()
coins = input().split()
coins = [int(coin) for coin in coins]
coins.sort(reverse=True)
my = 0
number = 0
other = sum(coins)
for coin in coins:
	number += 1
	my += coin
	other -= coin
	if my > other:
		break
print(number)


n = int(input())
coins = list(reversed(sorted(map(int, input().split()))))
b1 = []
x = 0
while coins:
	if sum(coins) >= sum(b1):
		b1.append(coins[x])
		coins.remove(coins[x])
	else:
		break
print(len(b1))


n = int(input())
A = [int(x) for x in input().split()]
B = [0]
C = [0]
A.sort()
for i in A:
	B.append(B[-1] + i)
for i in A[::-1]:
	C.append(C[-1] + i)
for i in range(n + 1):
	if C[i] > B[n - i]:
		print(i)
		break


n = int(input())
coin = [int(x) for x in input().split()]
a = 0
for i in range(len(coin)):
	a += coin[i]
b = 0
ncount = -1
coin.sort()
while b <= a - b:
	b += coin[ncount]
	ncount -= 1
print(-1 - ncount)


n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
sum = 0
cnt = 0
ans = 0
for i in l:
	sum += i
for i in l[::-1]:
	ans += i
	cnt += 1
	if ans > sum // 2:
		break
print(cnt)


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


input()
coins = list(map(int, input().split(' ')))
coins.sort(reverse=True)
twin_sum = sum(coins)
my_sum = 0
cnt = 0
for x in coins:
	if my_sum <= twin_sum:
		my_sum += x
		twin_sum -= x
		cnt += 1
print(cnt)


n = int(input())
ar = list(map(int, input().split()))
ar.sort()
su = sum(ar)
s = 0
j = n - 1
c = 0
while j >= 0 and su - s >= s:
	s += ar[j]
	c += 1
	j -= 1
print(c)


ss = lambda : input()
si = lambda : int(input())
si()
v = sorted(map(int, input().split()), reverse=True)
(sum, cur) = (sum(v), 0)
for (i, a) in enumerate(v):
	cur += a
	if cur * 2 > sum:
		print(i + 1)
		exit(0)


n = input()
a = [int(x) for x in input().split()]
a.sort(reverse=True)
b = sum(a) / 2
x = 0
t = 0
i = 0
while x <= b:
	x = x + a[t]
	t = t + 1
print(t)


a = int(input())
z = list(map(int, input().split()))
z.sort(reverse=True)
maxa = sum(z)
count = 0
for i in range(len(z)):
	if sum(z[0:i + 1]) > maxa - sum(z[0:i + 1]):
		print(i + 1)
		exit()


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

def merge_sort(arr):
	if len(arr) > 1:
		mid = len(arr) // 2
		left = arr[:mid]
		right = arr[mid:]
		left = merge_sort(left)
		right = merge_sort(right)
		arr = []
		while len(left) > 0 and len(right) > 0:
			if left[0] > right[0]:
				arr.append(left[0])
				left.pop(0)
			else:
				arr.append(right[0])
				right.pop(0)
		for i in left:
			arr.append(i)
		for i in right:
			arr.append(i)
	return arr
v = merge_sort(v)
a = 0
for i in v:
	a = a + i
b = 0
for i in range(len(v)):
	b = b + v[i]
	a = a - v[i]
	if b > a:
		print(i + 1)
		break


k = int(input())
b = [int(b) for b in input().split()]
b.sort()
sum1 = 0
sum2 = 0
for i in range(k):
	sum1 = sum1 + b[i]
for i in range(k):
	sum2 = sum2 + b[k - 1 - i]
	sum1 = sum1 - b[k - 1 - i]
	if sum2 > sum1:
		break
print(i + 1)


n = input()
count = 0
sum = 0
flag = 0
list1 = sorted(list(map(int, input().split())), reverse=1)
for i in list1:
	count += i
for i in list1:
	sum += i
	count -= i
	flag += 1
	if sum > count:
		break
print(flag)


a = input('')
limit = input('')
b = []
sum = 0

def get_the_list(count, limit, a):
	for i in range(0, len(limit)):
		if limit[i] == ' ':
			a.append(int(limit[int(count):int(i)]))
			count = i + 1
		elif i == len(limit) - 1:
			a.append(int(limit[int(count):len(limit)]))
	return a
coins_value = get_the_list(0, limit, b)
coins_value.sort(reverse=True)
for i in coins_value:
	sum += i
data = 0
data_count = 0
for i in coins_value:
	if data > sum / 2:
		break
	else:
		data += i
		data_count += 1
print(data_count)


n = int(input())
ar = input()
A = list(map(int, ar.split(' ')))
B = sorted(A, reverse=True)
sum = 0
for i in range(n):
	sum += B[i]
sum2 = 0
tut = 0
for i in range(n):
	sum2 += B[i]
	if sum2 > sum - sum2:
		tut = i + 1
		break
print(tut)


n = int(input())
lis = list(map(int, input().split()))
lis.sort(reverse=True)
sum1 = 0
ctr = 0
if len(lis) == 1:
	ctr = 1
else:
	for i in range(len(lis)):
		if sum1 > sum(lis[i:]):
			break
		elif sum1 <= sum(lis[i:]):
			sum1 += lis[i]
			ctr += 1
print(ctr)


import math
coins_count = int(input())
min_coins = coins_count
coins = sorted([int(x) for x in input().split()], reverse=True)
sum_middle = math.fsum(coins) / 2
for i in range(0, coins_count - 1):
	currentSum = coins[i]
	currentCoins = 1
	if currentSum > sum_middle:
		if currentCoins < min_coins:
			min_coins = currentCoins
			continue
	for j in range(i + 1, coins_count - 1):
		currentSum += coins[j]
		currentCoins += 1
		if currentSum > sum_middle:
			if currentCoins < min_coins:
				min_coins = currentCoins
				break
print(min_coins)


n = int(input())
s = input()
t = s.split()
a = [int(x) for x in t]
a.sort(reverse=True)
bl = sum(a)
for i in range(n):
	if sum(a) - bl <= bl:
		bl = bl - a[i]
	else:
		i = i - 1
		break
print(i + 1)


n = int(input())
a = []
s = input()
a = s.split()
for i in range(len(a)):
	a[i] = int(a[i])
a.sort()
i = len(a) - 1
sum = 1
while i > 0:
	s1 = 0
	s2 = 0
	for j in range(i):
		s1 += a[j]
	for j in range(i, len(a)):
		s2 += a[j]
	if s2 > s1:
		break
	else:
		i -= 1
		sum += 1
print(sum)


n = int(input())
ls = [int(x) for x in input().split()]
rem = sum(ls)
bounty = 0
num = 0
ls.sort(reverse=True)
for i in range(n):
	bounty += ls[i]
	rem -= ls[i]
	num += 1
	if bounty > rem:
		break
print(num)


n = int(input())
l = sorted(list(map(int, input().split())))[::-1]
s = sum(l) / 2
t = 0
for i in range(n):
	t += l[i]
	if t > s:
		print(i + 1)
		break


n = int(input())
lst = list(map(int, input().split()))
sum1 = sum(lst) // 2
lst.sort(reverse=True)
temp = 0
c = 0
for i in range(n):
	temp += lst[i]
	c += 1
	if temp > sum1:
		break
print(c)


n = int(input())
a = []
a = [int(i) for i in input().split()]
s = 0
sum = 0
sum1 = 0
a.sort()
a.reverse()
for i in range(n):
	sum += a[i]
	s += 1
	for j in range(i + 1, n):
		sum1 += a[j]
	if sum > sum1:
		break
	sum1 = 0
print(s)


sum1 = 0
n = int(input())
a = list(map(int, input().split(' ')))
sum2 = sum(a)
a.sort(reverse=True)
for i in range(0, len(a)):
	sum1 += a[i]
	sum2 -= a[i]
	if sum1 > sum2:
		print(i + 1)
		break


n = int(input())
list1 = list(map(int, input().split(' ')))
x = sum(list1)
list1.sort()
l = []
sum1 = 0
cou = 0
while sum1 <= x / 2:
	sum1 += list1[-1]
	l.append(list1[-1])
	list1.pop()
	cou += 1
print(cou)


n = input()
list1 = list(map(int, input().split()))
list1.sort()
list1.reverse()
k = s = 0
k1 = list1[0]
check = 0
for i in list1:
	k += i
	s += 1
	if k > sum(list1) / 2:
		print(s)
		break
	if check == 0:
		check = 1
		continue
	k1 += i


n = int(input())
coins = [int(i) for i in input().split()]
sum = 0
for j in coins:
	sum += j
avg = sum / 2
sum1 = 0
sum2 = 0
n = 0
coins.sort(reverse=True)
for j in coins:
	if sum1 <= avg:
		sum1 += j
		n += 1
	else:
		break
print(n)


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


n = int(input())
d = list(map(int, input().split()))
summ = 0
rezult = 0
while summ <= sum(d):
	summ += max(d)
	rezult += 1
	d[d.index(max(d))] = 0
print(rezult)


n = int(input())
l = [int(x) for x in input().split()]
l.sort(reverse=True)
minCoin = 0
total = sum(l)
currSum = 0
i = 0
while currSum <= total - currSum:
	minCoin += 1
	currSum += l[i]
	i += 1
print(minCoin)


numCoins = int(input())
values = input()
values = values.split()
values = [int(item) for item in values]
coinsTaken = []
while sum(coinsTaken) <= sum(values):
	coinsTaken.append(values.pop(values.index(max(values))))
print(len(coinsTaken))


input()
l = sorted(list(map(int, input().split())))
coun = 0
su = 0
while su <= sum(l):
	coun += 1
	su += l.pop()
print(coun)


N = int(input())
A = list(map(int, input().split(' ')))
if N == 1:
	print(1)
elif N == 2:
	if A[0] == A[1]:
		print(2)
	else:
		print(1)
else:
	A.sort()
	s = 0
	L = []
	R = []
	for i in range(N):
		s += A[i]
		L.append(s)
	s = 0
	for i in range(N - 1, -1, -1):
		s += A[i]
		R = [s] + R
	i = N - 1
	while R[i] <= L[i - 1]:
		i -= 1
	print(len(A) - i)


n = input()
arr = [int(x) for x in input().split()]
arr.sort(reverse=True)
(t, cnt, acc) = (0, 0, 0)
for x in arr:
	t += x
for x in arr:
	cnt += 1
	acc += x
	if acc > t - acc:
		break
print(cnt)


n = input()
z = list(map(int, input().split()))
z.sort()
z.reverse()
b = 0
for m in z:
	b = b + int(m)
c = 0
g = 0
for j in z:
	g = g + int(z[c])
	if g > b - g:
		continue
	else:
		c += 1
print(c + 1)


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
total = sum(coins)
a_sum = 0
a_coins = 0
for i in coins:
	a_sum += i
	a_coins += 1
	if a_sum > total - a_sum:
		print(a_coins)
		break


n = int(input())
l = list(input().split(' '))
l.sort(reverse=True, key=lambda x: int(x))
i = 0

def summary(l):
	s = 0
	for i in l:
		s += int(i)
	return s
s = summary(l)
for i in range(n):
	if summary(l[0:i + 1]) > s / 2:
		print(i + 1)
		break


s = 0

def ins(n):
	global s
	n = int(n)
	s += n
	return n
input()
a = list(map(ins, input().split()))
a.sort()
a.reverse()
d = 0
for i in range(len(a)):
	d += a[i]
	if d > s - d:
		print(i + 1)
		break


n = eval(input())
l = sorted(map(int, input().split()))
i = 0
sum = 0
j = 0
k = n - 2
c = 1
m = l[n - 1]
while i < n:
	j = 0
	sum = 0
	while j <= k:
		sum = sum + l[j]
		j = j + 1
	if m <= sum:
		m = m + l[k]
		k = k - 1
		c = c + 1
	else:
		break
	i = i + 1
print(c)


import sys

def solver(a):
	aSum = sum(a) / 2
	counter = 0
	sumOfCoins = 0
	b = sorted(a, reverse=True)
	for x in b:
		sumOfCoins = sumOfCoins + x
		counter = counter + 1
		if sumOfCoins > aSum:
			return counter

def main():
	lines = sys.stdin.readlines()
	newLines = list(map(int, lines[1].split()))
	print(solver(newLines))
main()


n = int(input())
s = input().split()
for i in range(n):
	s[i] = eval(s[i])
total = 0
for i in range(n):
	total = total + s[i]
for i in range(n):
	for k in range(n - 1):
		if s[k] < s[k + 1]:
			(s[k], s[k + 1]) = (s[k + 1], s[k])
me = 0
i = 0
while me <= total / 2:
	me = me + s[i]
	i = i + 1
print(i)


noc = int(input())
coins = list(map(int, input().split()))
ra = sorted(coins, reverse=True)
toc = 0
for i in ra:
	toc += int(i)
i = 0
s = 0
while s <= toc / 2:
	s += int(ra[i])
	i += 1
print(i)


n = int(input())
a = [int(item) for item in input().split(' ')]
a.sort()
a.reverse()
run_sum = 0
sum = sum(a)
ii = 0
while run_sum <= sum / 2:
	run_sum += a[ii]
	ii += 1
print(ii)


n = int(input())
array = list(map(int, input().split()))
array.sort(reverse=True)
tail = 1
head = 0
tailSum = 0
headSum = 0
for count in range(1, n + 1):
	headSum += array[head]
	tailCount = tail
	while tailCount < n:
		tailSum += array[tailCount]
		tailCount += 1
	if headSum > tailSum:
		break
	tailSum = 0
	head += 1
	tail += 1
print(tail)


n = int(input())
ary = list(map(int, input().split()))
sumA = 0
sumB = 0
res = 0
if n == 1:
	print(1)
	exit()
ary = sorted(ary)
while True:
	sumA += ary[-1]
	ary = ary[:-1]
	sumB = sum(ary)
	res += 1
	if sumA > sumB:
		break
print(res)


coincount = int(input())
coinList = list(input().split(' '))
coinList = list(map(int, coinList))
coinList.sort()
coinList.reverse()
half = sum(coinList) / 2
coinsTaken = 0
coinSum = 0
for x in coinList:
	coinsTaken += 1
	coinSum += x
	if coinSum > half:
		print(coinsTaken)
		exit()


n = int(input())
l = sorted(list(map(int, input().split())), reverse=True)
isStop = True
for i in range(n):
	if sum(l[:i]) > sum(l[i:]):
		print(len(l[:i]))
		isStop = False
		break
if isStop:
	print(n)


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
sum1 = 0
counter = 0
for i in range(n):
	counter += 1
	sum1 += coins[i]
	if sum1 > sum(coins[i + 1:]):
		print(counter)
		exit()
print(counter)


n = int(input())
s = [int(x) for x in input().split()]
ss = sorted(s)
sum = 0
sum1 = 0
count = 0
for i in ss:
	sum = sum + i
for j in ss[::-1]:
	sum1 = sum1 + j
	count = count + 1
	if 2 * sum1 > sum:
		break
print(count)


x = input()
li = list(map(int, input().split()))
li.sort()
li = li[::-1]
smr = sum(li)
sml = 0
i = 0
while i < len(li):
	sml += li[i]
	smr -= li[i]
	if sml > smr:
		print(i + 1)
		break
	i += 1


def read_inputs():
	number_of_coins = int(input())
	list_of_values = [int(value) for value in input().split(' ')]
	list_of_values.sort(reverse=True)
	return (number_of_coins, list_of_values)

def obtain_min_coins(number_coins, list_coins):
	max_sum = 0
	while len(list_coins) != 0:
		max_sum += list_coins[0]
		list_coins.remove(list_coins[0])
		if max_sum > sum(list_coins):
			break
	return number_coins - len(list_coins)
(coins_number, value_list) = read_inputs()
print(obtain_min_coins(coins_number, value_list))


s = input()
A = input().split()
for (i, num) in enumerate(A):
	A[i] = int(num)
A.sort(reverse=True)
b = sum(A)
c = 0
i = 0
while 2 * c <= b:
	c += A[i]
	i = i + 1
print(i)


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)

def Cnum(l):
	for i in range(len(l) - 1):
		if sum(l[:i + 1]) > sum(l[i + 1:]):
			return i + 1
	return len(l)
print(Cnum(l))


def innt(a, n):
	innt = list()
	for i in range(n):
		innt.append(int(a[i]))
	return innt
n = int(input())
lis = innt(input().split(), n)
lis.sort(reverse=True)
a = sum(lis)
value = 0
for i in range(n):
	value += lis[i]
	if value > a - value:
		print(i + 1)
		break


n = int(input())
a = list(map(int, input().split()))
b = sorted(a)
c = []
for i in range(len(b) - 1, -1, -1):
	c.append(b[i])
(m, n, count, i) = (0, 0, 0, 0)
while m <= n:
	m = sum(c[0:i + 1])
	n = sum(c[i + 1:])
	i += 1
	count += 1
print(count)


n = int(input())
data = [int(i) for i in input().split()]
data = sorted(data)
data.reverse()
for i in range(1, len(data)):
	data[i] += data[i - 1]
for i in range(len(data)):
	if data[i] > data[len(data) - 1] - data[i]:
		print(i + 1)
		break


n = int(input())
coins = list(map(int, input().split()))
half = sum(coins) / 2
total = 0
coin = 0
for i in reversed(sorted(coins)):
	total += i
	coin += 1
	if total > half:
		break
print(coin)


a = input()
b = [int(x) for x in input().split(' ')]
count = 0
c = 0
b.sort()
t = 0
while t == 0:
	if count <= sum(b):
		count += b[-1]
		c += 1
		del b[-1]
	else:
		break
print(c)


n = int(input())
coins = sorted(list(map(int, input().split())), reverse=True)
su = sum(coins)
su2 = 0
count = 0
for i in range(n):
	coin = coins[i]
	su2 += coin
	su -= coin
	count += 1
	if su2 > su:
		break
print(count)


n = int(input())
a = [int(i) for i in input().split()]
s = sum(a)
s = s // 2 + 1
a.sort(reverse=True)
i = 0
while s > 0:
	s = s - a[i]
	i = i + 1
print(i)


qtd = int(input())
moedas = list(map(int, input().split()))
moedas.sort(reverse=True)
soma = sum(moedas)
minhas = []
s = 0
for moeda in moedas:
	s += moeda
	minhas.append(moeda)
	if s > soma / 2:
		break
print(len(minhas))


n = int(input())
a = sorted(list(map(int, input().split())), reverse=1)
i = 1
while sum(a[0:i]) <= sum(a) // 2:
	i += 1
print(i)


numberOfCoins = int(input())
allCoins = sorted(list(map(int, input().split(' '))))
yourCoins = []
times = len(allCoins)
for i in range(0, times):
	if sum(yourCoins) > sum(allCoins):
		break
	else:
		yourCoins.append(allCoins.pop())
print(len(yourCoins))


n = int(input())
s = [int(i) for i in input().split()]
A = 0
X = 1
S = 0
for i in range(len(s)):
	A = A + int(s[i])
s = sorted(s)
for i in range(len(s)):
	S = S + int(s[n - i - 1])
	if S > 0.5 * A:
		break
	else:
		X = X + 1
print(X)


n = int(input())
a = list(map(int, input().split()))
a.sort()
k = 0
l = 0
while sum(a) >= l:
	k += 1
	l += a.pop(-1)
print(k)


n_coins = int(input())
v_coins = input()
v_coins = v_coins.split(' ')
counter = 0
for i in range(n_coins):
	v_coins[i] = int(v_coins[i])
total_money = 0
rich_twin = 0
v_coins.sort(reverse=True)
for i in range(n_coins):
	total_money += v_coins[i]
for i in range(n_coins):
	rich_twin += v_coins[i]
	counter += 1
	if rich_twin > total_money / 2:
		break
print(int(counter))


n = int(input())
x = sorted([int(x) for x in input().split()], reverse=True)
sum = 0
for i in x:
	sum += i
sum = sum / 2
(m, ans) = (0, 0)
for i in x:
	m += i
	ans += 1
	if m > sum:
		break
print(ans)


import math

def read_ints():
	return map(int, input().split())
t = int(input())
a = []
a = list(read_ints())
a.sort(reverse=True)
sum = 0
cnt = 0
amar_taka = 0
for i in range(t):
	sum += a[i]
for i in range(t):
	amar_taka += a[i]
	sum -= a[i]
	cnt += 1
	if amar_taka > sum:
		break
print(cnt)


input()
mas = sorted(list(map(int, input().split())))
b = c = 0
while b <= sum(mas):
	b += mas.pop()
	c += 1
print(c)


n = int(input())
a = sorted([int(x) for x in input().split()], reverse=True)
s1 = 0
for i in range(n):
	s1 += a[i]
	s2 = 0
	for j in range(i + 1, n):
		s2 += a[j]
	if s1 > s2:
		t = i + 1
		break
print(t)


n = int(input())
line = [int(i) for i in input().split()]
line = sorted(line, reverse=True)
total = sum(line)
k = 0
s = 0
for i in line:
	if 2 * s <= total:
		k += 1
		s += i
print(k)


input()
l = sorted(list(map(int, input().split())))
l.reverse()
sum1 = 0
for (i, j) in enumerate(l):
	sum1 += j
	if sum1 > sum(l) / 2:
		print(i + 1)
		break


brah = input()
x = input().split()
y = []
for i in range(len(x)):
	y.append(int(x[i]))
y.sort(reverse=True)
count = 0
q = 0
p = sum(y) / 2
while q <= p:
	q = q + y[count]
	count += 1
print(count)


A = int(input())
B = input().split(' ')
suma = 0
for x in range(len(B)):
	suma += int(B[x])
for x in range(len(B)):
	for y in range(x + 1, len(B)):
		if int(B[x]) < int(B[y]):
			Aux = int(B[x])
			B[x] = int(B[y])
			B[y] = Aux
acumu = 0
count = 0
for x in range(len(B)):
	if acumu <= suma:
		acumu += int(B[x])
		suma -= int(B[x])
		count += 1
	else:
		break
print(count)


n = int(input())
l = list(map(int, input().split(' ')))
sum1 = sum(l)
ans = 0
res = 0
l.sort()
for i in range(n - 1, -1, -1):
	ans += l[i]
	res += 1
	if ans > sum1 / 2:
		break
print(res)


from sys import stdin

def main():
	a = int(stdin.readline().strip())
	b = [int(x) for x in stdin.readline().strip().split()]
	b.sort()
	b.reverse()
	suma = sum(b)
	ans = 0
	res = 0
	for i in range(len(b)):
		ans += b[i]
		if ans > suma - ans:
			res = i + 1
			break
	print(res)
main()


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


a = int(input())
c = list(input().split())
for i in range(len(c)):
	c[i] = int(c[i])
c.sort(reverse=True)
d = sum(c)
d = d // 2 + 1
sumi = 0
i = 0
for j in c:
	sumi = sumi + j
	i = i + 1
	if sumi >= d:
		break
print(i)


n = input()
x = input()
y = x.split()
sum = 0
for i in range(len(y)):
	y[i] = int(y[i])
	sum += y[i]
y.sort(reverse=True)
(sum1, i) = (0, 0)
while i < len(y):
	sum1 += int(y[i])
	if sum1 > sum // 2:
		break
	i += 1
print(i + 1)


n = int(input())
coins = sorted(list(map(int, input().split())), reverse=True)
c_sum = sum(coins)
t_sum = 0
ans = 0
for i in range(n):
	if t_sum > c_sum:
		break
	t_sum += coins[i]
	c_sum -= coins[i]
	ans += 1
print(ans)


num_coin = int(input())
value = [int(num_coin) for num_coin in input().split()]
sums = sum(value)
half_sum = sums / 2
reverse = sorted(value, reverse=True)
count = 0
your_sum = 0
for k in reverse:
	your_sum = your_sum + k
	count = count + 1
	if your_sum > half_sum:
		break
print(count)


sa = int(input())
sa2 = input().split(' ')
sa3 = []
for element in sa2:
	sa3.append(int(element))
sa3.sort()
target = int(sum(sa3) / 2) + 1
sa3.reverse()
sumxx = 0
number = 0
while sumxx < target:
	sumxx += sa3[0]
	sa3.remove(sa3[0])
	number += 1
print(number)


n = int(input())
array = list(map(int, input().split()))
array.sort()
array.reverse()
result = []
for i in array:
	result.append(i)
count = []
haha = True
i = 0
while haha:
	if sum(count) > sum(array):
		break
	count.append(result[i])
	array.remove(result[i])
	i += 1
print(len(count))


import math
n = int(input())
value = []
qtd = 0
value = [int(i) for i in input().split()]
value.sort(reverse=True)
i = 0
count = 0
while i < n and count <= sum(value) / 2:
	count += value[i]
	qtd += 1
	i += 1
print(qtd)


n = int(input())
a = list(map(int, input().split()))
b = []
while sum(a) >= sum(b):
	m = max(a)
	b.append(m)
	a.remove(m)
print(len(b))


N = int(input())
coins = [int(x) for x in input().split()]
coins = list(reversed(sorted(coins)))
i = 0
while sum(coins[:i]) <= sum(coins[i:]):
	i += 1
print(i)


n = int(input())
l = list(map(int, input().split()))
s = sum(l)
(i, j, c) = (0, n - 1, 0)
l.sort()
while i <= s and j >= 0:
	i = i + l[j]
	s = s - l[j]
	c = c + 1
	j = j - 1
print(c)


n = int(input())
g = input()
g = [int(s) for s in g.split() if s.isdigit()]
g.sort()
sum = 0
max = g[len(g) - 1]
for x in range(len(g) - 1):
	sum += g[x]
count = 0
y = 1
max = 0
sum = 0
while True:
	max += g[n - y]
	count += 1
	for i in range(n - y):
		sum += g[i]
	if max > sum:
		print(count)
		break
	y += 1
	sum = 0


n = int(input())
array = list(map(int, input().split()))
array.sort()
array.reverse()
i = 1
frontSum = sum(array[0:i])
backSum = sum(array[1:])
while frontSum <= backSum:
	i += 1
	frontSum = sum(array[0:i])
	backSum = sum(array[i:])
print(i)


n = int(input())
a = list(map(int, input().split()))
su = sum(a)
su = su / 2
a.sort()
cnt = 0
ans = 0
for i in range(n - 1, -1, -1):
	ans += a[i]
	cnt += 1
	if ans > su:
		break
print(cnt)


n = int(input())
money = []
s = 0
money = str(input())
money_list = [int(m) for m in money.split()]
sum = money_list[0]
for i in range(1, n):
	x = i
	sum += money_list[i]
	while money_list[x] > money_list[x - 1] and x > 0:
		(money_list[x], money_list[x - 1]) = (money_list[x - 1], money_list[x])
		x -= 1
j = 0
while s <= sum / 2:
	s += money_list[j]
	j += 1
print(j)


def main():
	n = int(input())
	s1 = input()
	w = s1.split(' ')
	s2 = []
	co = 0
	for i in w:
		q = int(i)
		s2.append(q)
	i = 0
	s2.sort()
	s = s2[::-1]
	while i < n:
		shi = sum(s[:i + 1])
		anu = sum(s[i + 1:])
		if shi > anu:
			co = len(s[:i + 1])
			break
		else:
			i += 1
	print(co)
main()


n = int(input())
x = input().split()
x1 = [int(y) for y in x]
c = list(reversed(sorted(x1)))
for i in range(len(x)):
	a = [int(y) for y in c[:i + 1]]
	b = [int(y) for y in c[i + 1:]]
	if sum(a) > sum(b):
		print(i + 1)
		exit()
	else:
		continue


n = int(input())
ar = list(map(int, input().split()))
s = sum(ar)
ar.sort(reverse=True)
c = 0
for q in range(n):
	c = c + ar[q]
	if c > s - c:
		print(q + 1)
		break


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


n = int(input())
s = input()
s = s.split()
results = list(map(int, s))
results.sort(reverse=True)
sum = 0
for i in results:
	sum = sum + i
sum2 = 0
count = 0
for i in results:
	count += 1
	sum2 = sum2 + i
	sum = sum - i
	if sum2 > sum:
		print(count)
		break


f = input
f()
s = sorted(map(int, f().split()), reverse=True)
print(max([i + 1 if sum(s[:i]) <= sum(s[i:]) else 0 for i in range(len(s))]))


n = int(input())
s = input()
a = s.split()
for i in range(0, n):
	a[i] = int(a[i])
a.sort(reverse=True)
firstsum = 0
lastsum = 0
count = 0
for i in range(0, n):
	lastsum = lastsum + a[i]
i = 0
while firstsum <= lastsum:
	firstsum += a[i]
	lastsum -= a[i]
	i += 1
	count += 1
print(count)


x = input()
y = map(int, input().split())
y = sorted(y, reverse=True)
z = 0
for i in y:
	z += i
a = 0
for i in range(len(y)):
	a += y[i]
	if a > z // 2:
		print(i + 1)
		break


n = int(input())
a = list(map(int, input().split()))
summ = sum(a)
leftsum = summ
takensum = 0
count = 0
while takensum <= leftsum:
	leftsum -= max(a)
	takensum += max(a)
	count += 1
	a.remove(max(a))
print(count)


n = int(input())
coins = input()
coins_list = [int(x) for x in coins.split()]
req = sum(coins_list) / 2
coins_list.sort(reverse=True)
num = 0
temp_sum = 0
for i in coins_list:
	if temp_sum <= req:
		temp_sum = temp_sum + i
		num = num + 1
	else:
		break
print(num)


_ = input()
coins = sorted([int(n) for n in input().split(' ')])
my_coins = []
while sum(my_coins) <= sum(coins):
	my_coins.append(coins.pop())
print(len(my_coins))


n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
r = sum(a)
t = n // 2
s = 0
for i in range(len(a)):
	s += a[i]
	if s > r // 2:
		print(i + 1)
		break


n = int(input())
s = 0
c = 0
count = 0
a = sorted(list(map(int, input().split())), reverse=True)
for i in a:
	s += i
b = s // 2
for i in a:
	c += i
	count += 1
	if c > b:
		break
print(count)


n = int(input())
coins = [int(x) for x in input().split()]
coins = sorted(coins, reverse=True)
n = len(coins)
total = 0
mySum = 0
twinSum = 0
res = 0
for i in range(0, n):
	total += coins[i]
for i in range(1, n + 1):
	for j in range(0, i):
		mySum += coins[j]
	if mySum > total - mySum:
		print(i)
		break
	mySum = 0


n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(len(a)):
	for j in range(len(a) - 1, i, -1):
		if a[j] > a[j - 1]:
			(a[j], a[j - 1]) = (a[j - 1], a[j])
for i in range(1, len(a) + 1):
	b = a[0:i]
	if sum(a) - sum(b) < sum(b):
		print(len(b))
		break


data = input()
data = input().split(' ')
summ = 0
for i in range(len(data)):
	data[i] = int(data[i])
	summ += data[i]
half = int(summ / 2)
data.sort(reverse=True)
temp = []
for i in range(len(data)):
	if sum(temp) <= half:
		temp.append(data[i])
		continue
print(len(temp))


from sys import stdin, stdout

def main():
	n = int(stdin.readline().rstrip())
	coins = list(map(int, stdin.readline().rstrip().split()))
	coins.sort()
	total = 0
	for coin in coins:
		total += coin
	numberOfCoins = 0
	mySum = 0
	while mySum * 1.0 / total <= 0.5:
		mySum += coins[len(coins) - 1]
		coins.pop()
		numberOfCoins += 1
	stdout.write(str(numberOfCoins) + '\n')
main()


n = int(input())
a = [int(x) for x in input().split()]
s = sum(a)
c = 0
i = 0
d = 0
a.sort(reverse=True)
while c <= s:
	c += a[i]
	s -= a[i]
	d += 1
	i += 1
print(d)


first = int(input())
number = sorted([int(i) for i in input().split()], reverse=True)
for i in range(1, first + 1):
	a = number[0:i]
	b = number[i:]
	if sum(a) > sum(b):
		print(i)
		break


n = int(input())
coins = [int(x) for x in input().split(' ')]
coins.sort(reverse=True)
x = sum(coins)
count = 0
smallsum = 0
for i in coins:
	count += 1
	smallsum += i
	if smallsum > x / 2:
		break
print(count)


x = int(input())
p = list(map(int, input().split()))
p.sort()
s = 0
j = 0
while s <= sum(p) - s:
	s += p[-j - 1]
	j += 1
print(j)


from math import ceil
c = int(input())
ci = list(sorted(map(int, input().split())))
s = sum(ci) // 2
total = 0
coins = 0
for v in ci[::-1]:
	total += v
	coins += 1
	if total > s:
		break
print(coins)


a = int(input())
coins = list(map(int, input().split()))
m = 0
l = 0
s = sum(coins)
coins.sort()
while s >= m:
	x = coins[-1]
	m += x
	s -= x
	l += 1
	coins.pop()
print(l)


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


n = int(input())
lst = list(map(int, input().strip().split()))[:n]
lst.sort(reverse=True)
ap = []
c = 0
for (i, j) in enumerate(lst):
	a = lst[i]
	lst[i] = 0
	ap.append(a)
	c += 1
	if sum(ap) > sum(lst):
		break
print(c)


monets = int(input())
nominals = list(map(int, input().split()))
nominals.sort(reverse=True)
sum = sum(nominals)
got = count = 0
for i in range(monets):
	if got > sum / 2:
		print(count)
		break
	got += nominals[i]
	count += 1
	if i == monets - 1:
		print(i + 1)


quantity = int(input())
money = [int(i) for i in input().split()]
money = sorted(money)
summa = sum(money)
counter = 0
amount = 0
while amount <= summa / 2:
	counter += 1
	amount += money[-1]
	money = money[:-1]
print(counter)


n = int(input())
a = list((int(i) for i in input().split()))
max_value = max(a) + 1
f = max_value * [0]
sum = 0
total = 0
num = 0
for i in range(n):
	f[a[i]] += 1
	total += a[i]
for i in range(max(a), 0, -1):
	while f[i] > 0:
		if sum <= total // 2:
			f[i] -= 1
			sum += i
			num += 1
		else:
			break
print(num)


n = int(input())
s = 0
k = 0
value = [int(x) for x in input().split()]
value.sort(reverse=True)
for x in value:
	s = s + x
for i in range(n):
	k = k + value[i]
	if k > s - k:
		print(i + 1)
		break


from bisect import bisect
from itertools import accumulate
n = int(input())
a = list(accumulate(sorted(map(int, input().split()), reverse=True)))
print(bisect(a, a[-1] / 2) + 1)


a = int(input())
b = [int(x) for x in input().split()]
c = sorted(b, reverse=True)
for i in range(0, a):
	if sum(c[:i + 1]) > sum(c[i + 1:]):
		print(len(c[:i + 1]))
		break


n = int(input())
a = [-int(i) for i in input().split()]
a = sorted(a)
a = [-i for i in a]
s = 0
k = 0
m = 0
for i in range(len(a)):
	k += 1
	m += a[i]
	s = 0
	for j in range(i + 1, len(a)):
		s += a[j]
	if m > s:
		break
print(k)


a = int(input())
b = input().split()
s = 0
for i in range(a):
	b[i] = int(b[i])
	s += b[i]
b = sorted(b)
b.reverse()
s2 = 0
for i in range(a):
	s2 += b[i]
	s -= b[i]
	if s2 > s:
		print(i + 1)
		break


n = int(input())
coins = input().split()
for i in range(0, n):
	coins[i] = int(coins[i])
coins.sort()
limit = 0
big = 1
lit = 0
while big > lit:
	big = 0
	lit = 0
	for j in coins[limit:]:
		big += j
	for k in coins[:limit]:
		lit += k
	limit += 1
limit -= 1
big = 0
lit = 0
for j in coins[limit:]:
	big += j
for k in coins[:limit - 1]:
	lit += k
ans = n - limit + 1
print(ans)


n = int(input())
coins = tuple(map(int, input().split()))
coins = sorted(coins)
s = sum(coins)
mine = 0
count = 0
for i in reversed(coins):
	mine += i
	count += 1
	if mine > s - mine:
		break
print(count)


n = int(input())
l = list(map(int, input().split(' ')))
a = sum(l)
ans = 0
i = 0
l.sort()
l.reverse()
while ans <= a / 2:
	ans += l[i]
	i += 1
print(i)


n = input()
a = sorted(list(map(int, input().split(' '))), reverse=True)
s = sum(a) // 2
v = 0
count = 0
for i in a:
	count += 1
	v += i
	if v > s:
		break
print(count)


n = int(input())
l = [None] * n
l = list(map(int, input().split()))
l.sort(reverse=True)
l1 = []
for i in range(0, len(l)):
	l1.append(l[i])
	if sum(l1) > sum(l[i + 1:]):
		break
print(len(l1))


n = input()
z = input()
coin = z.split(' ')
cf = []
sum = 0
count = 0
g = 0
for i in coin:
	p = float(i)
	cf.append(p)
c = sorted(cf, reverse=True)
for j in c:
	sum = sum + j
sumh = sum / 2
for j in c:
	g = g + j
	count = count + 1
	if g > sumh:
		print(count)
		break


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
i = 0
while sum(a[:i]) <= sum(a[i:]):
	i += 1
else:
	print(i)


num = int(input())
value = list(map(int, input().split()))
value.sort()
big = []
while sum(big) <= sum(value):
	big.append(value.pop())
print(len(big))


n = int(input())
a = sorted([int(s) for s in input().split()])
s2 = sum(a)
s1 = 0
cnt = 0
for i in reversed(a):
	cnt += 1
	s1 += i
	s2 -= i
	if s1 > s2:
		break
print(cnt)


n = input()
money = sorted([int(x) for x in input().split(' ')], reverse=True)
(sum1, sum2) = (0, sum(money))
m = 0
for i in money:
	sum1 += i
	m += 1
	if sum1 > sum2 - sum1:
		break
print(m)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
b = sum(a) / 2
c = 0
count = 0
for j in a:
	c += j
	count += 1
	if c > b:
		break
print(count)


n = int(input())
a = list(map(int, input().split()))
b = []
a.sort()
i = -1
c = 0
while len(a) > 0:
	if sum(b) > sum(a):
		break
	b.append(a[i])
	a.remove(a[i])
	c += 1
print(c)


n = input()
coins = list(map(int, input().split()))
coins.sort(reverse=True)
takens = 0
sum_taken = 0
sum_coins = 0
for i in coins:
	sum_coins += i
for j in coins:
	sum_taken += j
	takens += 1
	if sum_coins / 2 < sum_taken:
		break
print(takens)


n = int(input())
a = list(map(int, input().split()))
a.sort()
s = sum(a)
t_sum = 0
count = 0
for i in range(n):
	t_sum += a[n - i - 1]
	count += 1
	if t_sum > s / 2:
		break
print(count)


n = int(input())
input_list = input().split()
co = []
tot = 0
for i in range(n):
	co.append(int(input_list[i]))
	tot = tot + co[i]
coin = sorted(co, reverse=True)
k = 0
cur = 0
while cur <= tot / 2:
	cur = cur + coin[k]
	k += 1
print(k)


n = int(input())
ar = list(map(int, input().split()))
su = sum(ar) / 2
ar.sort()
ar = list(reversed(ar))
s = 0
for x in range(n):
	s += ar[x]
	if s > su:
		print(x + 1)
		exit(0)


n = int(input())
coin = [int(x) for x in input().split()]
b = len(coin)
s = 0
for i in range(b):
	s += coin[i]
coin.sort(reverse=True)
numm = 0
my = 0
for i in range(b):
	my += coin[i]
	numm += 1
	if my > s / 2:
		print(numm)
		break


n = int(input().strip())
coins = sorted([int(i) for i in input().strip().split()])
s = sum(coins)
mine = 0
i = 0
while mine <= s:
	mine += coins[-1]
	s -= coins[-1]
	coins = coins[:-1]
	i += 1
print(i)


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
share = sum(coins) // 2
mine = 0
counter = 0
for coin in coins:
	mine += coin
	counter += 1
	if mine > share:
		break
print(counter)


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
aux = []
s = 0
for i in l:
	s += i
	aux.append(s)
for i in range(len(aux)):
	if aux[i] > aux[-1] - aux[i]:
		print(i + 1)
		break


n = int(input())
a = list(map(int, input().split()))
a.sort()
average = sum(a) / 2
sum = count = 0
i = len(a) - 1
while sum <= average:
	sum += a[i]
	i -= 1
	count += 1
print(count)


n = int(input())
coins = list(map(int, input().split()))
total = 0
my_value = 0
my_count = 0
coins.sort()
coins.reverse()
for coin in coins:
	total += coin
for coin in coins:
	my_value += coin
	my_count += 1
	if my_value > total // 2:
		print(my_count)
		break


n = int(input())
entry = input().split(' ')
newl = []
sol = []
for i in range(n):
	newl.append(int(entry[i]))
while sum(sol) <= sum(newl):
	sol.append(max(newl))
	newl.remove(max(newl))
print(len(sol))


n = int(input())
li = list(map(int, input().strip().split(' ')))[:n]
li.sort(reverse=True)
s2 = sum(li)
si = 0
c = 0
for i in li:
	si = si + i
	s2 = s2 - i
	c += 1
	if si > s2:
		print(c)
		break


n = int(input())
coins = sorted(list(map(int, input().strip().split())))
goal = sum(coins) / 2
taken = []
while sum(taken) <= goal:
	taken.append(coins.pop())
print(len(taken))


n = int(input())
l = list(map(int, input().split()))
sum = 0
for i in l:
	sum += i
h = int(sum / 2) + 1
l.sort()
s1 = 0
m = 0
for j in range(len(l)):
	s1 += l[len(l) - 1 - j]
	m += 1
	if s1 >= h:
		print(m)
		break
	else:
		continue


n = int(input())
a = list(map(int, input().split()))
a = list(reversed(sorted(a)))
x = sum(a)
sm = 0
c = 0
for i in range(n):
	if sm > x:
		break
	else:
		sm += a[i]
		x -= a[i]
		c += 1
print(c)


n = int(input())
mine = 0
values = [int(x) for x in input().split()]
values.sort(reverse=True)
average = sum(values) / 2
for i in range(n):
	mine += values[i]
	if mine > average:
		print(i + 1)
		break


n = int(input())
amount = list(map(int, input().split()))
amount.sort()
total = 0
p = len(amount) - 1
for i in amount:
	total += i
split = total / 2
take = 0
y = 0
while split >= take:
	y += 1
	take += amount[p]
	p -= 1
print(y)


n = int(input())
i = 0
coin = [int(x) for x in input().split()]
coin.sort(reverse=True)
while sum(coin[:i]) <= sum(coin[i:]):
	i = i + 1
print(i)


n = int(input())
coins = sorted([int(x) for x in input().split()])
sum1 = count = 0
while sum1 <= sum(coins):
	sum1 += coins.pop()
	count += 1
print(count)


n = int(input())
a = input().split(' ')
total = 0
for i in a:
	total += int(i)
highesti = 0
mycoins = []
while sum(mycoins) <= total / 2:
	for i in range(len(a)):
		if int(a[i - 1]) > int(a[highesti]):
			highesti = i - 1
	mycoins.append(int(a.pop(highesti)))
print(len(mycoins))


num = int(input())
coins = sorted(list(map(int, input().split())), reverse=True)
if num == 1:
	print(1)
elif num == 2 and coins[0] == coins[1]:
	print(2)
else:
	for i in range(num):
		if sum(coins[:i]) > sum(coins[i:]):
			print(i)
			break


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
i = 0
res = 0
while res <= sum(a):
	res += a.pop(0)
	i += 1
print(i)


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


input()
a = sorted((int(x) for x in input().split()))[::-1]
for x in range(1, len(a) + 1):
	if sum(a[:x]) > sum(a[x:]):
		print(x)
		break


n = int(input())
a = [int(x) for x in input().split()][:n]
a.sort()
a.reverse()
count = 0
total = 0
for i in range(0, n):
	total += a[i]
	count += 1
	if total > int(sum(a) / 2):
		print(count)
		break
		break


a = int(input())
b = input().split()
for i in range(a):
	b[i] = int(b[i])
b.sort(reverse=True)
c = sum(b)
d = 0
for i in range(a):
	d = d + b[i]
	if d > c / 2:
		e = i + 1
		break
print(e)


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
s1 = l[0]
s2 = sum(l[1:])
c = 1
while s2 >= s1:
	s1 += l[c]
	s2 -= l[c]
	c += 1
print(c)


n = int(input())
coins = list(map(int, input().split()))
coins.sort()
counter = 0
sum_a = 0
sum_b = sum(coins)
for i in range(n - 1, -1, -1):
	sum_a += coins[i]
	sum_b -= coins[i]
	counter += 1
	if sum_a > sum_b:
		break
print(counter)


n = eval(input())
l = list(map(int, input().split()))
sumb = sum(l)
l = sorted(l, reverse=True)
c = 0
d = 0
i = 0
while i < n and d <= sumb:
	d += l[i]
	sumb -= l[i]
	c += 1
	i += 1
print(c)


no_coins = int(input())
coins = list(map(int, input().split()))
total = 0
sum1 = 0
arr = 0
for val in range(0, len(coins)):
	total += int(coins[val])
coins.sort(reverse=True)
for i in coins:
	sum1 += int(i)
	arr += 1
	if sum1 > total / 2:
		break
print(arr)


n = int(input())
l = list(map(int, input().split()))
count = 0
money = 0
total = sum(l)
l.sort(reverse=True)
i = 0
while money <= total - money:
	money += l[count]
	count += 1
print(count)


n = int(input())
a = []
b = []
b.append(0)
for x in input().split():
	a.append(int(x))
a.sort()
b.append(a[0])
for i in range(1, n):
	b.append(a[i] + b[-1])
c = [None for i in range(n)]
c[-1] = a[-1]
for i in range(n - 2, -1, -1):
	c[i] = a[i] + c[i + 1]
for i in range(n - 1, -1, -1):
	if c[i] > b[i]:
		print(n - i)
		break


n = int(input())
coins = sorted(list(map(int, input().split(' '))))
(numCoins, i) = (0, len(coins) - 1)
while sum(coins[:i + 1]) >= sum(coins[i + 1:]):
	numCoins += 1
	i -= 1
print(numCoins)


n = int(input())
s = sorted(map(int, input().split()))
for i in range(n - 1, -1, -1):
	if sum(s[i:]) > sum(s[:i]):
		print(n - i)
		exit()


n = int(input())
if n >= 1 and n <= 100:
	strCoins = input()
	coinsValues = list(map(int, strCoins.split()))
	coinsValues.sort()
	coinsValues.reverse()
	x = 0
	while x < len(coinsValues):
		x += 1
		if sum(coinsValues[0:x]) > sum(coinsValues[x:len(coinsValues)]):
			break
	print(len(coinsValues[0:x]))


n = int(input())
q = 0
x = input().split()
(sum, y, r) = (0, 0, 0)
for k in range(n):
	x[k] = int(x[k])
x.sort()
x.reverse()
for i in x:
	sum += int(i)
for i in x:
	y += int(i)
	r = r + 1
	if y > sum // 2:
		q = 1
		print(r)
		break
if q == 0:
	print(n)


n = int(input())
c = list(map(int, input().split()))
c.sort(reverse=True)
half = sum(c) / 2
ttl = 0
for (i, num) in enumerate(c):
	ttl += num
	if ttl > half:
		print(i + 1)
		break


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
summ = 0
ct = 0
for i in a[::-1]:
	summ += i
	ct += 1
	if summ > sum(a) - summ:
		print(ct)
		break


n = int(input())
l = list(map(int, input().split(' ')))
l.sort(reverse=True)
l.append(0)
ans = 0
for i in range(1, len(l)):
	t1 = l[:i]
	t2 = l[i:]
	if sum(t1) > sum(t2):
		ans = i
		break
print(ans)


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


c = input()
s = list(map(int, input().split()))
s = sorted(s, reverse=True)
sum = 0
for i in s:
	sum += int(i)
m = 0
c = 0
for i in s:
	if m <= sum / 2:
		c += 1
	m += i
print(c)


t = int(input())
coins = list(map(int, input().split()))
total = 0
coint = 0
for c in sorted(coins, reverse=True):
	if total <= sum(coins) / 2:
		total += c
		coint += 1
print(coint)


n = input()
s = input()
s = s.split()
array = []
for i in s:
	array.append(int(i))
array.sort(reverse=True)
_sum = sum(array)
temporary_sum = 0
count = 0
for i in array:
	temporary_sum += i
	count += 1
	if temporary_sum > _sum / 2:
		break
print(count)


n = int(input())
p = input().split()
l = []
i = 0
sum = 0
while i < n:
	l.append(int(p[i]))
	sum = sum + int(p[i])
	i = i + 1
l.sort()
s = 0
c = 0
for i in range(n - 1, -1, -1):
	s = s + l[i]
	c = c + 1
	if s > sum - s:
		break
print(c)


n = int(input())
a = list(map(int, input().split()))
b = sorted(a, reverse=True)
tsum = sum(a)
ans = 0
sum = 0
for i in range(n):
	sum += b[i]
	tsum -= b[i]
	if sum > tsum:
		ans = i + 1
		break
print(ans)


def maj(a):
	s = 0
	for i in a:
		s = s + i
	return s
n = int(input())
coins = list(map(int, input().split()))
coins.sort(key=None, reverse=True)
c = 0
s = 0
i = -1
while c == 0 and len(coins) != 0:
	i = i + 1
	s = s + coins[0]
	coins.pop(0)
	if s > maj(coins):
		print(i + 1)
		c = 1


n = int(input())
a = str(input()).split()
l = len(a)
for k in range(l):
	a[k] = int(a[k])
a.sort()
s1 = sum(a) / 2
s2 = 0
for i in range(l):
	s2 += a[l - i - 1]
	if s2 > s1:
		break
print(i + 1)


n = int(input())
l = list(map(int, input().split()))
s = sum(l)
l.sort()
s1 = 0
x = len(l)
count = 0
for i in range(x - 1, -1, -1):
	s1 += l[i]
	count += 1
	s = s - l[i]
	if s1 > s:
		break
print(count)


n = int(input())
l = list(map(int, input().split()))
l.sort()
sum = 0
c = 0
count = 0
for i in l:
	sum += i
l.reverse()
for i in l:
	c += i
	count += 1
	if c > sum / 2:
		break
print(count)


import sys

def get_minimum_coins(coins):
	coins.sort(reverse=True)
	total_money_half = int(sum(coins) / 2)
	my_coins = 0
	coinsCnt = 0
	for coin in coins:
		my_coins += coin
		coinsCnt += 1
		if my_coins > total_money_half:
			return coinsCnt
	return len(coins)
	return True
n = int(input().strip())
coins = list(map(int, input().split(' ')))
minimum_coins = get_minimum_coins(coins)
print(minimum_coins)


import math
from decimal import Decimal

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)

def ist(x):
	d = 1
	while d < x:
		d *= 2
	return d == x
(n, a) = na()
k = 0
s1 = sum(a)
s2 = 0
a.sort(reverse=True)
for i in a:
	s2 += i
	s1 -= i
	k += 1
	if s2 > s1:
		print(k)
		exit()


def main():
	nb = int(input())
	tab = list(map(int, input().split()))
	somme = 0
	for x in tab:
		somme += x
	moyenne = somme / 2
	somme = 0
	tab.sort(reverse=True)
	for (i, x) in enumerate(tab):
		somme += x
		if somme > moyenne:
			print(i + 1)
			return
main()


n = input()
a = input().split()
for i in range(len(a)):
	a[i] = int(a[i])
a = sorted(a)[::-1]
(m, k) = (0, 0)
for i in a:
	k += i
	m += 1
	if k > sum(a) / 2:
		print(m)
		break


N = int(input())
num = input()
num = num.split(' ')
lis = []
for i in num:
	lis.append(int(i))
lis.sort()
lis.reverse()
sum = 0
for i in lis:
	sum += i
cnt = 0
for i in range(N):
	now = 0
	for i2 in range(i + 1):
		now += lis[i2]
	if now > sum - now:
		cnt = i
		break
print(cnt + 1)


n = int(input())
a = input().split()
total = 0
for i in range(n):
	a[i] = int(a[i])
	total += a[i]
for i in range(n):
	for j in range(i):
		if a[i] > a[j]:
			tmp = a[i]
			a[i] = a[j]
			a[j] = tmp
s = 0
i = 0
c = 0
while s <= total / 2 and i < n:
	s += a[i]
	i += 1
	c += 1
print(c)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
s = sum(a)
(res, x) = (0, 0)
for i in a:
	if x <= s // 2:
		res += 1
		x += i
	else:
		break
print(res)


n = int(input().strip())
coins = [int(coin) for coin in input().strip().split(' ')]
ts = sum(coins)
coins = sorted(coins, reverse=True)
sum = 0
for i in range(n):
	sum += coins[i]
	if sum > ts // 2:
		break
print(i + 1)


coins = []
n = int(input())
ai = input().split()
ai = [int(x) for x in ai]
coins = coins + ai
coins.sort(reverse=True)
s = sum(coins)
t = 0
res = 0
for c in coins:
	t += c
	res += 1
	if t > s - t:
		print(res)
		exit()


aantal = int(input())
Waardes = input().split(' ')
Som = 0
Weggenomen = 0
Munten = 0
for i in range(0, aantal):
	Som += int(Waardes[i])
	Waardes[i] = int(Waardes[i])
Waardes = sorted(Waardes)
for j in range(aantal - 1, -1, -1):
	if Weggenomen <= Som / 2:
		Weggenomen += int(Waardes[j])
		Munten += 1
	else:
		break
print(Munten)


n = int(input())
a = input()
a = a.split()
a = [int(x) for x in a]
b = sorted(a)
new = list(reversed(b))
s = 0
da = sum(a) / 2
for i in range(n):
	s = s + new[i]
	if s > da:
		print(i + 1)
		break


inp = int(input())
a = [int(x) for x in input().split(' ')]
for i in range(len(a) - 1):
	for j in range(i + 1, len(a)):
		if a[i] > a[j]:
			temp = a[i]
			a[i] = a[j]
			a[j] = temp
sum = 0
for i in a:
	sum += i
hsl = 0
for i in range(-1, -len(a) - 1, -1):
	sum -= 2 * a[i]
	hsl += 1
	if sum < 0:
		break
print(hsl)


from sys import stdin, stdout

def arraySum(A):
	total = 0
	for i in A:
		total += i
	return total

def twins(N, A):
	coinTotal = 0
	coinCount = 0
	while coinTotal <= arraySum(A):
		coinCount += 1
		maxCoin = 0
		for i in range(1, len(A)):
			if A[i] > A[maxCoin]:
				maxCoin = i
		coinTotal += A[maxCoin]
		del A[maxCoin]
	return coinCount
N = int(stdin.readline())
stdout.write(str(twins(N, list(map(int, stdin.readline().split())))))


n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
summ = 0
summ1 = 0
count = 0
for i in l:
	summ += i
for i in l[::-1]:
	summ1 += i
	count += 1
	if summ1 > summ / 2:
		break
print(count)


def howManyCoins(ncoins, values):
	values = sorted(values)
	coins = 0
	howMany = 0
	for i in values[::-1]:
		coins += i
		howMany += 1
		if coins > sum(values) / 2:
			break
	return howMany
ncoins = int(input())
values = [int(i) for i in input().split()]
print(howManyCoins(ncoins, values))


n = int(input())
a = list(map(int, input().split()))
s_2 = 0
m = n - 1
s_1 = sum(a)
a.sort()
while s_1 >= 2 * s_2:
	s_2 += a[m]
	m -= 1
print(n - 1 - m)


n = int(input())
l = list(map(int, input().split()))
numCoins = len(l)
l.sort()
ss = sum(l)
sister = 0
i = 0
while i < numCoins and sister < ss - sister:
	sister += l[i]
	i += 1
print(numCoins - i + 1)


n = int(input())
ar = list(map(int, input().split()))
ans = 0
s = 0
summ = sum(ar)
ar.sort(reverse=True)
for i in ar:
	s = s + i
	ans = ans + 1
	if s > summ / 2:
		break
print(int(ans))


n = int(input())
l = sorted(map(int, input().split()))
s = [0]
for i in range(n):
	s.append(s[-1] + l[i])
for i in range(n - 1, -1, -1):
	if s[-1] - s[i] > s[i]:
		print(n - i)
		break


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


n = int(input())
s = [int(x) for x in input().strip().split(' ')]
tot = sum(s)
i = 0
pick = 0
s.sort(reverse=True)
while i < len(s):
	x = s[i]
	pick = pick + x
	if 2 * pick > tot:
		break
	i = i + 1
print(i + 1)


n = int(input())
l = list(map(int, input().split()))
c = 0
summ = sum(l)
l = sorted(l, reverse=True)
for i in range(n):
	c += l[i]
	if c > summ - c:
		break
print(i + 1)


def minimum_coin(n, coins):
	sum = 0
	count = 0
	coins = coins.split()
	for i in range(len(coins)):
		coins[i] = int(coins[i])
		sum += coins[i]
	coins.sort()
	val = 0
	while val <= sum / 2 and len(coins) > 0:
		val += coins.pop(-1)
		count += 1
	print(count)
minimum_coin(int(input()), input())


(n, a) = (input(), list(map(int, input().split())))
half = sum(a) / 2
(coin, quantity) = (0, 0)
for (i, v) in enumerate(reversed(sorted(a))):
	quantity += v
	coin += 1
	if quantity > half:
		break
print(coin)


n = int(input())
list1 = list(input().split())
list1 = [int(x) for x in list1]
x = sorted(list1)
z = []
k = 0
while sum(z) <= sum(list1) - sum(z):
	z.append(x[len(x) - k - 1])
	k += 1
print(k)


n = int(input())
lst = sorted(list(map(int, input().split())), reverse=True)
total = sum(lst)
number = 0
now = 0
for i in lst:
	now += i
	number += 1
	if now > total - now:
		print(number)
		break


N = int(input())
lista = [int(i) for i in input().split()]
lista.sort(reverse=True)
media = int(sum(lista) / 2)
(ans, j) = (0, 0)
for i in lista:
	j = j + 1
	ans += i
	if ans > media:
		break
print(j)


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
i = 0
while sum(l[:i]) <= sum(l[i:]):
	i += 1
print(i)


input()
nums = sorted([int(x) for x in input().split()])
total = sum(nums)
(my, res) = (0, 0)
while my <= total - my:
	my += nums.pop()
	res += 1
print(res)


b = int(input())
c = list(map(int, input().split()))
c.sort(reverse=True)
y = sum(c)
x = 0
for i in range(b):
	x += c[i]
	y -= c[i]
	if x > y:
		print(i + 1)
		break


input()
coins = list(map(int, input().split()))
half_sum = sum(coins) // 2
(my_sum, n) = (0, 0)
coins.sort()
while my_sum <= half_sum:
	n += 1
	my_sum += coins[-n]
print(n)


n = int(input())
li = list()
s = input()
for i in s.split():
	li.append(int(i))
li = sorted(li, reverse=True)
j = 1
for k in range(n):
	if sum(li[0:j]) > sum(li[j:]):
		print(len(li[:j]))
		break
	j = j + 1
exit()


n = int(input())
a = [int(i) for i in input().split()]
m = 0
d = 0
maj = 0
for you in range(len(a)):
	maj += a[you]
while m <= maj // 2:
	t = 0
	for i in range(len(a) - d):
		if a[i] > t:
			t = a[i]
			x = i
	z = a[len(a) - 1 - d]
	a[len(a) - 1 - d] = t
	a[x] = z
	m += t
	d += 1
print(d)


no_of_coins = int(input())
coins = list(map(int, input().split()))
coins = sorted(coins, reverse=True)
total = sum(coins)
if len(coins) != 1:
	n = 1
	(mine, yours) = (sum(coins[:n]), sum(coins[n:]))
	while mine <= yours:
		(mine, yours) = (sum(coins[:n]), sum(coins[n:]))
		n += 1
	if n == 1:
		print(len(coins[:n]))
	else:
		print(len(coins[:n - 1]))
else:
	print(1)


PočetMinci = int(input())
mince = list(map(int, input().split()))
mince.sort(reverse=True)
Sucet = 0
MojeMince = 0
vysledok = 0
for i in range(len(mince)):
	Sucet += mince[i]
for i in range(len(mince)):
	MojeMince += mince[i]
	vysledok += 1
	if MojeMince > Sucet / 2:
		break
print(vysledok)


n = int(input())
coins = [int(i) for i in input().split()]
coins.sort(reverse=True)
s = sum(coins)
my = 0
for i in range(len(coins)):
	my += coins[i]
	if my > s - my:
		print(i + 1)
		break


n = int(input())
coins = []
maxBro = 0
minBro = 0
howMany = 0
coins = [int(i) for i in input().split()]
while maxBro <= minBro:
	minBro = 0
	for coin in coins:
		minBro += coin
	maxBro += max(coins)
	minBro -= max(coins)
	coins.pop(coins.index(max(coins)))
	howMany += 1
maxBro = 0
print(howMany)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
k = sum(a)
m = 0
for i in a:
	k -= i
	m += 1
	if k < sum(a) / 2:
		print(m)
		break


t = int(input())
lst = list(map(int, input().split()))
lst.sort()
lst = lst[::-1]
q = 0
if sum(lst) % 2 == 0:
	p = sum(lst) / 2
	for i in range(len(lst)):
		q += lst[i]
		if q > p:
			print(i + 1)
			break
else:
	p = sum(lst) // 2 + 1
	for i in range(len(lst)):
		q += lst[i]
		if q >= p:
			print(i + 1)
			break


N = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
prefix = [0]
suffix = [sum(coins)]
for i in range(1, N + 1):
	prefix.append(prefix[i - 1] + coins[i - 1])
	suffix.append(suffix[i - 1] - coins[i - 1])
for i in range(1, N + 1):
	if prefix[i] > suffix[i]:
		print(i)
		break


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


n = int(input())
lst = list(map(int, input().split()))
lst.sort(reverse=True)
summ = sum(lst) // 2
i = 0
count = 0
while count <= summ:
	count += lst[i]
	i += 1
print(i)


input()
ls = [int(x) for x in input().split()]
ls = list(reversed(sorted(ls)))
d = 0
k = 1
while k <= len(ls):
	if sum(ls[:k]) > sum(ls[k:]):
		d = len(ls[:k])
		break
	else:
		k += 1
print(d)


n = int(input())
ints = [int(s) for s in input().split() if s.isdigit()]
ints.sort()
m = 0
i = 0
while m <= sum(ints):
	m += ints.pop()
	i += 1
print(i)


import sys
input = sys.stdin.readline

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

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

def insr():
	s = input()
	return list(s[:len(s) - 1])
num = inp()
seq = inlt()
seq.sort(reverse=True)
s = sum(seq)
half = s / 2
amount = 0
counter = 0
while amount <= half:
	amount += seq.pop(0)
	counter += 1
print(counter)


n = int(input())
l = list(map(int, input().split()))
l = sorted(l, reverse=True)
sum2 = 0
sum1 = sum(l)
f = 0
for i in range(len(l)):
	sum2 += l[i]
	if sum2 > sum1 - sum2:
		f = i + 1
		break
if f == 0:
	print(n)
else:
	print(f)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
if n == 1:
	print(n)
else:
	sum = 0
	tot = 0
	for i in a:
		tot += i
	for i in range(0, n):
		sum += a[i]
		if sum > tot - sum:
			print(i + 1)
			break


coins = int(input())
arr = sorted(list(map(int, input().split())), reverse=True)
half = sum(arr) / 2
count_coin = 0
my_money = 0
while my_money <= half:
	my_money += arr[count_coin]
	count_coin += 1
print(count_coin)


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
total_sum = sum(l)
current_sum = 0
count = 0
for i in l:
	current_sum += i
	total_sum -= i
	count += 1
	if current_sum > total_sum:
		break
print(count)


n = input('')
x = list(map(int, input().split()))
x.sort(reverse=True)
total = 0
for i in range(len(x)):
	total = total + x[i]
half = total / 2
j = 0
maximum = 0
coins = 0
while j < len(x) and maximum <= half:
	maximum = maximum + x[j]
	j += 1
	coins += 1
print(coins)


n = int(input())
l = list(map(int, input().split()))
l.sort()
l.reverse()
min_total = sum(l) // 2
s = l[0]
i = 1
count = 1
while s <= min_total and i < len(l):
	s += l[i]
	count += 1
	i += 1
print(count)


n = int(input(''))
a = [int(x) for x in input('').split()]
a.sort(reverse=True)
ans = 0
total = sum(a)
me = 0
while ans < n and me <= total / 2:
	me += a.pop(0)
	ans += 1
print(ans)


a = int(input())
b = list(map(int, input().split()))
c = 1
b = sorted(b, reverse=1)
p = b[0]
q = sum(b[1:])
if p > q:
	print(c)
else:
	for i in b[1:]:
		p += i
		q -= i
		c += 1
		if p > q:
			break
	print(c)


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
sm = 0
cnt = 0
t = sum(l)
i = 0
while sm <= t - sm and i < len(l):
	sm = sm + l[i]
	i = i + 1
if sm > 0:
	print(i)
else:
	print(0)


input()
a = sorted(map(int, input().split()))
s = c = 0
while s <= sum(a):
	s += a.pop()
	c += 1
print(c)


n = int(input())
coins = [int(i) for i in input().split()]
coins.sort(reverse=True)
for i in range(1, n + 1):
	if sum(coins[:i]) > sum(coins[i:]):
		print(i)
		break


n = int(input())
lst = list(map(int, input().strip().split()))
lst.sort()
lst.reverse()
c = 0
for i in range(0, n):
	s = sum(lst[0:i + 1])
	s1 = sum(lst[i + 1:n + 1])
	c += 1
	if s > s1:
		break
print(c)


n = int(input())
m = input().split()
m2 = [int(i) for i in m]
m2.sort()
his = sum(m2)
total = his
while his >= total / 2:
	his -= m2.pop()
print(n - len(m2))


n = int(input())
a = [int(s) for s in input().split()]
s = sum(a)
s1 = 0
a = sorted(a, reverse=True)
for i in range(n):
	s1 += a[i]
	if s1 > s - s1:
		print(i + 1)
		break


n = int(input())
monety = list(map(int, input().split(' ')))
monety.sort(reverse=True)
x = sum(monety) / 2
suma = 0
k = 0
for i in monety:
	suma += i
	k += 1
	if suma > x:
		break
print(k)


n = int(input())
coins = 0
a = list(map(int, input().split()))
flag = sum(a)
a = sorted(a, reverse=True)
Sum = 0
for num in a:
	Sum += num
	flag -= num
	coins += 1
	if Sum > flag:
		break
print(coins)


n = int(input())
l = list(map(int, input().split()))
s1 = 0
c = 1
l.sort()
k = n - 1
s2 = l[k]
for i in range(0, n - 1):
	s1 = s1 + l[i]
while s2 <= s1:
	k -= 1
	s2 = s2 + l[k]
	s1 = s1 - l[k]
	c += 1
print(c)


n = int(input())
l = sorted(map(int, input().split()), reverse=True)
a = 0
i = 0
while a <= sum(l) / 2:
	a += l[i]
	i += 1
print(i)


n = int(input())
lst = sorted(list(map(int, input().split())), reverse=True)
total = 0
count = 0
for i in lst:
	if total <= sum(lst) - total:
		total += i
		count += 1
print(count)


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


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
sm = sum(arr)
idx = n - 1
total = 0
while idx >= 0 and total <= sm - total:
	total += arr[idx]
	idx -= 1
print(n - idx - 1)


n = int(input())
x = [int(x) for x in input().split()]
x.sort(reverse=True)
total = sum(x) // 2
(i, t) = (0, 0)
c = 0
while i < len(x) and t <= total:
	t += x[i]
	i += 1
	c += 1
print(c)


n = int(input())
coins = [int(a) for a in input().split()]
total = 0
x = 0
for coin in sorted(coins, reverse=True):
	if total <= sum(coins) - total:
		total += coin
		x += 1
	else:
		break
print(x)


m = int(input())
a = list(map(int, input().split()))
a.sort()
b = m - 1
c = 0
sa = sum(a)
sb = 0
while sa >= sb:
	sa -= a[b]
	sb += a[b]
	b -= 1
	c += 1
print(c)


n = int(input())
a = list(map(int, input().split()))
s = sum(a)
b = sorted(a)
s1 = 0
x = 0
while s1 <= s:
	s1 += b[n - 1]
	s -= b[n - 1]
	n -= 1
	x += 1
print(x)


n = int(input())
b = map(int, input().split())
c = list(b)
c.sort()
h = 0
temp = 0
tol = 0
for i in range(n):
	tol += c[i]
tol = tol / 2
for i in range(n):
	temp += c[n - 1 - i]
	h += 1
	if temp > tol:
		break
print(h)


def main():
	_ = input()
	coins = list(map(int, input().split()))
	coins.sort()
	min_coins = 0
	cur_count = 0
	low = 0
	high = len(coins) - 1
	while low <= high:
		if cur_count - coins[low] > 0:
			cur_count -= coins[low]
			low += 1
		else:
			cur_count += coins[high]
			min_coins += 1
			high -= 1
	print(min_coins)
main()


a = input()
b = []
b = input().split(' ')
a = int(a)
b = sorted([int(i) for i in b])
s = sum(b) / 2
ans = 0
ccc = 0
pos = len(b) - 1
for i in range(len(b)):
	ans = ans + b[pos]
	ccc += 1
	pos -= 1
	if ans > s:
		break
print(ccc)


n = int(input())
value = [int(x) for x in input().split()]
total = 0
for i in range(n):
	total += value[i]
total = total // 2 + 1
for i in range(n):
	for j in range(i - 1, -1, -1):
		if value[j + 1] > value[j]:
			a = value[j]
			value[j] = value[j + 1]
			value[j + 1] = a
		else:
			break
money = 0
for i in range(n):
	money += value[i]
	if money >= total:
		print(i + 1)
		break


p = int(input())
s = 0
ha = tuple(map(int, input().split()))
arr = []
for i in range(len(ha)):
	arr.append(ha[i])

def bubbleSort(arr):
	n = len(arr)
	for i in range(n):
		for j in range(0, n - i - 1):
			if arr[j] > arr[j + 1]:
				(arr[j], arr[j + 1]) = (arr[j + 1], arr[j])
bubbleSort(arr)
for i in range(len(arr)):
	s += arr[i]
asd = 0
for i in range(len(arr)):
	asd += arr[len(arr) - 1 - i]
	if asd > 0.5 * s:
		print(i + 1)
		break


import math
a = int(input())
ll = list(map(int, input().split()))
l = sorted(ll, reverse=True)
s = 0
b = 0
n = sum(l)
if a == 1 or (a == 2 and l[0] > l[1]):
	print(int(1))
elif a == 2 and l[0] == l[1]:
	print(int(2))
else:
	for i in range(1, len(l)):
		s += l[i - 1]
		b += 1
		if s > n - s:
			break
	print(b)


n = input()
s = input().split(' ')
m = []
m = [int(s[i]) for i in range(len(s))]
m = sorted(m, reverse=True)
for i in range(len(m)):
	if sum(m[:i + 1]) > sum(m[i + 1:]):
		print(i + 1)
		break


from heapq import heapify, heappop

def find(arr, n):
	nr = [-x for x in arr]
	heapify(nr)
	t = c = 0
	s = sum(arr) // 2
	while 1:
		if t > s:
			break
		t += abs(heappop(nr))
		c += 1
	return c
n = int(input())
arr = list(map(int, input().split()))
print(find(arr, n))


n = input()
a = [int(x) for x in input().split()]
b = 0
c = sum(a)
ans = 0
for x in sorted(a, reverse=True):
	ans += 1
	b += x
	if b > c - b:
		break
print(ans)


import sys
n = int(input())
coins = input().split()
coins = [int(i) for i in coins]
coins.sort()
totalSum = sum(coins)
totalSum /= 2
mySum = 0
count = 0
j = len(coins) - 1
while j >= 0:
	mySum += coins[j]
	count += 1
	if mySum > totalSum:
		break
	j -= 1
print(count)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=1)
total_sum = sum(a)
half = total_sum // 2
half += 1
i = 0
my_sum = 0
while my_sum < half:
	my_sum += a[i]
	i += 1
print(i)


a = int(input())
b = list(map(int, input().strip().split(' ')))
b.sort(reverse=True)
sum = 0
for k in b:
	sum += k
t = 0
g = 0
while g <= sum / 2:
	g += b[t]
	t += 1
print(t)


n = int(input())
m = [int(x) for x in input().split(' ')]
k = 0
s = 0
m.sort()
m.reverse()
for x in range(len(m)):
	p = 0
	k += m[x]
	s += 1
	for j in range(x + 1, len(m)):
		p += m[j]
	if k > p:
		print(s)
		break


coinCount = int(input())
coinValues = [int(x) for x in input().split(' ')]
coinValues.sort(reverse=True)
totalValue = sum(coinValues)
coinsToTake = 0
valueOfCoinsTaken = 0
for x in coinValues:
	coinsToTake += 1
	valueOfCoinsTaken += x
	if valueOfCoinsTaken > totalValue - valueOfCoinsTaken:
		break
print(coinsToTake)


n = int(input())
mine = 0
num = 0
a = sorted((int(i) for i in input().split()))
a.reverse()
zhongzhi = sum(a) / 2
for i in a:
	num += 1
	mine += i
	if mine > zhongzhi:
		print(num)
		break


num = int(input())
mm = input().split()
data = []
for i in mm:
	data.append(int(i))
data = sorted(data)
x = 1
while x <= len(data):
	if sum(data[-1:-x - 1:-1]) > sum(data[:len(data) - x]):
		print(x)
		break
	x += 1


from collections import Counter

def find_min_coins(coins):
	pass
	rest_sum = sum((coin * number for (coin, number) in coins.items()))
	count = 0
	sum_ = 0
	for i in sorted(coins.keys(), reverse=True):
		while coins[i]:
			count += 1
			sum_ += i
			coins[i] -= 1
			rest_sum -= i
			if sum_ > rest_sum:
				return count
n = input()
coins = Counter(map(int, input().split()))
print(find_min_coins(coins))


n = int(input())
arr = sorted(list(map(int, input().split())))
s1 = s2 = 0
while s1 <= sum(arr):
	s1 += arr.pop()
	s2 += 1
print(s2)


n = int(input())
list = [int(x) for x in input().split()]
sum = 0
for i in range(n):
	value = list[i]
	sum = sum + value
list1 = list.sort(reverse=True)
sum1 = 0
m = 0
for a in range(n):
	value = list[a]
	sum1 = sum1 + value
	m += 1
	if sum1 * 2 > sum:
		print(m)
		break


def coins(l):
	l.sort()
	a = l[::-1]
	c = 0
	if len(l) == 1:
		return 1
	else:
		for i in range(1, len(l) + 1):
			if sum(a[:i]) > sum(a[i:]):
				c += 1
				break
			else:
				c += 1
		return c
n = int(input())
l = list(map(int, input().split()))
print(coins(l))


from sys import stdin, stdout
inp = stdin.readline
out = stdout.write
n = int(inp().strip())
l = list(map(int, inp().strip().split()))
l.sort()
s = c = 0
while s <= sum(l):
	s += l.pop()
	c += 1
out(str(c))


n = int(input())
l = sorted(list(map(int, input().split())))
l.reverse()
s = sum(l)
count = 0
curr_s = 0
while curr_s <= s:
	curr_s += l[0]
	s -= l[0]
	count += 1
	l.pop(0)
print(count)


def main():
	input()
	coins = list(map(int, input().split()))
	coins.sort(reverse=True)
	half = sum(coins) // 2
	count = 0
	taken_sum = 0
	for coin in coins:
		if taken_sum > half:
			break
		taken_sum += coin
		count += 1
	print(count)
main()


def main():
	n = input()
	prob = sorted([int(number) for number in input().split()], reverse=True)
	index = 1
	while sum(prob[:index]) <= sum(prob[index:]):
		index += 1
	print(len(prob[:index]))
main()


a = int(input())
t = input()
t = t.split()
t = [int(t[i]) for i in range(a)]
sum = 0
for i in t:
	sum += i
t = sorted(t)
k = sum / 2
c = 0
while sum >= k:
	c += 1
	sum -= t[-1]
	del t[-1]
print(c)


a = int(input())
b = list(map(int, input().split()))
c = 0
for i in range(a):
	c += b[i]
c /= 2
b.sort()
d = 0
while c >= 0:
	c -= b[-1]
	d += 1
	b.pop()
print(d)


x = int(input())
y = [int(i) for i in input().split()]
y.sort()
y.reverse()
for i in range(x - 1):
	if sum(y[0:i + 1]) > sum(y[i + 1:x]):
		print(i + 1)
		raise SystemExit
print(x)


n = int(input())
coins = list(map(int, input().split()))
my_sum = 0
coin_sum = sum(coins)
num = 0
while my_sum <= coin_sum:
	largest_coin = max(coins)
	my_sum += largest_coin
	num += 1
	coin_sum -= largest_coin
	coins.remove(max(coins))
print(num)


n = int(input())
a = sorted(list(map(int, input().split())))
broo = sum(a[:n])
me = 0
conta = 0
while True:
	if broo < me:
		print(conta)
		break
	n -= 1
	me += a[n]
	conta += 1
	broo -= a[n]


def add(x):
	out = 0
	for i in x:
		out += i
	return out
n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
_sum = add(coins)
mid = _sum / 2
sumA = 0
count = 0
for i in coins:
	if sumA <= mid:
		sumA += i
		count += 1
	else:
		break
print(count)


s = int(input())
t = input()
t = t.split()
somme = 0
for i in range(s):
	t[i] = int(t[i])
	somme += t[i]
somme = somme / 2
t = sorted(t, reverse=True)
q = 0
k = 0
while q <= somme:
	q += t[k]
	k += 1
print(k)


test = int(input())
coins = [int(x) for x in input().split()]
coins.sort()
sum = 0
count = 0
for x in coins:
	sum = sum + x
len = test
sums = 0
rem = sum
while len > 0:
	sums = sums + coins[len - 1]
	rem = sum - sums
	count = count + 1
	if sums > rem:
		break
	len = len - 1
print(count)


n = int(input())
arr = [int(i) for i in input().split()]
arr.sort(reverse=True)
sum = 0
for i in range(n):
	sum = sum + arr[i]
total_sum = sum
new_sum = 0
count = 1
for i in range(n):
	total_sum = total_sum - arr[i]
	new_sum = new_sum + arr[i]
	if new_sum > total_sum:
		print(count)
		break
	else:
		count += 1


n = input()
text = input().split(' ')
numb = []
for i in text:
	numb.append(int(i))
numb = sorted(numb)
summ = 0
for i in numb:
	summ += int(i)
summ2 = summ // 2 + 1
summ = 0
i = len(numb) - 1
while summ < summ2:
	summ += int(numb[i])
	i -= 1
print(len(numb) - 1 - i)


n = int(input())
coins = list(map(int, input().split()))
coins = sorted(coins)
sum_a = sum(coins)
sum_b = 0
c = 0
while sum_a >= sum_b:
	c += 1
	sum_b += coins[len(coins) - c]
	sum_a -= coins[len(coins) - c]
print(c)


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

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

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

def ss():
	return [x for x in input()]
a = ii()
s = sorted(si(), reverse=True)
b = sum(s)
c = 0
ans = 0
while c <= b:
	it = s.pop(0)
	b -= it
	c += it
	ans += 1
print(ans)


import math
coin = int(input())
val = []
val = list(map(int, input().split()))
val = sorted(val)
z = 0
c = 0
sum = 0
for i in range(coin):
	sum = sum + int(val[i])
i = coin - 1
s = sum / 2
while z <= s:
	z = z + int(val[i])
	c += 1
	i -= 1
print(c)


number = int(input())
s = input()
a = s
list = s.split()
for i in range(len(list)):
	list[i] = int(list[i])
list = sorted(list)
s = list[-1]
list.pop(-1)
i = 0
z = 1
for i in range(len(a)):
	p = 0
	for j in range(len(list)):
		p = p + list[j]
	if s <= p:
		s = s + list[-1]
		list.pop(-1)
		z = z + 1
print(z)


from itertools import combinations
import sys
n = int(input())
ls = list(map(int, input().split()))
s = sum(ls)
ls.sort()
ls.reverse()
minn = sys.maxsize
for i in range(n):
	s1 = sum(ls[:i + 1])
	l = len(ls[:i + 1])
	if s1 > s // 2 and l < minn:
		minn = l
if minn == sys.maxsize:
	print(len(ls))
else:
	print(minn)


x = int(input())
z = input().split()
lst = list(map(int, z))
lst.sort(reverse=True)
total = sum(lst)
apun = 0
for i in range(len(lst)):
	apun += lst[i]
	if apun > total - apun:
		break
print(i + 1)


m = input()
n = list(map(int, input().split()))
n.sort(reverse=True)
j = 0
for i in range(len(n) + 1):
	p = n[:i + 1]
	q = n[i + 1:]
	j = j + 1
	if sum(p) > sum(q):
		print(j)
		break


n = int(input())
lin = input().split()
su = int(0)
line = []
for l in lin:
	su += int(l)
	line.append(int(l))
line.sort()
line.reverse()
s = int(0)
c = int(0)
for m in line:
	c += 1
	s += int(m)
	su -= m
	if s > su:
		break
print(c)


n = int(input())
coins = list(map(int, input().split()))
coins = sorted(coins, reverse=True)
sumOfAll = sum(coins)
sumIhave = 0
count = 0
for x in coins:
	if sumIhave > sumOfAll - sumIhave:
		break
	else:
		sumIhave += x
		count += 1
print(count)


n = int(input())
coins = sorted(list(map(int, input().split())), reverse=1)
sum_coins = sum(coins)
num_coins = sum_temp = 0
for coin in coins:
	num_coins += 1
	sum_temp += coin
	sum_coins -= coin
	if sum_temp > sum_coins:
		break
print(num_coins)


input()
(a, b, c, d) = (0, 0, list(), 0)
for x in input().split():
	t = int(x)
	c.append(t)
	a += t
c.sort(reverse=True)
for x in c:
	d += 1
	b += x
	a -= x
	if b > a:
		break
print(d)


n = int(input())
l = [int(x) for x in input().split()]
s = sum(l)
l.sort()
l = l[::-1]
f = 0
for i in range(n):
	for j in range(i + 1, n + 1):
		l1 = l[i:j]
		if sum(l1) > s - sum(l1):
			print(len(l1))
			f = 1
			break
	if f == 1:
		break


n = int(input())
l = list(map(int, input().split(' ')))
l.sort(reverse=True)
(s, s1) = (0, 0)
for i in range(0, n):
	for j in range(0, i + 1):
		s = s + l[j]
	for k in range(i + 1, n):
		s1 = s1 + l[k]
	if s > s1:
		print(i + 1)
		break
	(s, s1) = (0, 0)


input()
l = [int(a) for a in input().split()]
l.sort(reverse=True)
t = sum(l) / 2
s = 0
for (i, v) in enumerate(l):
	s += v
	if s > t:
		print(i + 1)
		break


a = int(input())
coins = [int(i) for i in input().split()]
if a == 1:
	print(1)
	exit()
coins = sorted(coins)[::-1]
taken = 0
amount = 0
while taken <= sum(coins):
	taken += coins[0]
	amount += 1
	del coins[0]
print(amount)


kol = int(input())
b = list(map(int, input().split()))
b = sorted(b, reverse=True)
s = sum(b)
m = 0
for i in range(kol):
	m = m + b[i]
	if m > s / 2:
		print(i + 1)
		break


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
i = 0
j = len(a) - 1
sum1 = a[i]
sum2 = a[j]
while i < int(len(a)) - 1:
	if i < j:
		if sum1 > sum2:
			j -= 1
			sum2 += a[j]
		elif sum1 == sum2 and i >= j:
			i += 1
			sum1 += a[i]
			sum2 -= a[j]
		else:
			i += 1
			sum1 += a[i]
	else:
		break
print(i + 1)


import sys
n = int(sys.stdin.readline())
in_str = []
summa = 0
for i in sys.stdin.readline().split(' '):
	a = int(i)
	summa += a
	in_str.append(a)
in_str.sort(reverse=True)
b = 0
count = 0
for j in in_str:
	if b > summa:
		break
	else:
		b += j
		summa -= j
		count += 1
print(count)


n = int(input())
coins = [int(a) for a in input().split()]
coins.sort(reverse=True)
sum_coins = sum(coins)
b = 0
ans = 1
for i in range(0, n):
	b += coins[i]
	if b <= sum_coins / 2:
		ans += 1
	else:
		break
print(ans)


n = int(input())
l = list(map(int, input().split()))
l.sort()
tot = 0
x = sum(l)
ls = []
if len(l) == 2 and l[0] == l[1]:
	print(len(l))
else:
	for i in reversed(range(len(l))):
		tot = tot + l[i]
		ls.append(l[i])
		y = x / 2
		if tot > y:
			break
	print(len(ls))


n = int(input())
a = list(map(int, input().split()))
b = []
a_copy = a.copy()
a.sort()
for i in a_copy:
	b.append(a.pop())
	if sum(b) > sum(a):
		break
print(len(b))


n = int(input())
s = input().split(' ')
l = [int(num) for num in s]
l.sort(reverse=True)
if n == 1:
	print(1)
	exit()
for i in range(1, n):
	if sum(l[:i]) > sum(l[i:]):
		print(i)
		break
	if i == n - 1:
		if sum(l[:i]) == sum(l[i:]):
			print(n)
			break


n = int(input())
a = sorted(map(int, input().split()), reverse=True)
c = 0
summ = 0
for i in range(n):
	if summ > sum(a) // 2:
		break
	else:
		summ += a[i]
		c += 1
print(c)


n = int(input())
from sys import stdin, stdout
map1 = map(int, stdin.readline().rstrip().split())
arra = list(map1)
arra.sort(reverse=True)
money = 0
for i in range(n):
	if sum(arra[:i + 1]) > sum(arra[i + 1:]):
		print(i + 1)
		break
	money += arra[i]


import sys
import math

def is_lucky(m):
	return all(map(lambda x: x in {'4', '7'}, set(str(m))))

def main():
	n = int(sys.stdin.readline().strip())
	s = 0
	l = list(map(int, sys.stdin.readline().strip().split(' ')))
	for e in l:
		s += e
	ts = 0
	for (i, e) in enumerate(sorted(l, reverse=True)):
		ts += e
		if ts > s // 2:
			sys.stdout.write(str(i + 1))
			return
main()


from heapq import nlargest
n = int(input())
v = list(map(int, input().split()))
t = sum(v) / 2
nl = nlargest
for i in range(1, n + 1):
	if sum(nl(i, v)) > t:
		print(i)
		break


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


n = int(input())
coins = list(map(int, input().split()))
coins.sort()
(count, v) = (0, 0)
for j in range(len(coins) - 1, -1, -1):
	count += 1
	v += coins[j]
	if v > sum(coins) // 2:
		break
print(count)


n = int(input())
a = [int(i) for i in input().split()]
(s1, s2) = (sum(a), 0)
a.sort()
for i in range(n - 1, -1, -1):
	s2 += a[i]
	if s2 > s1 - s2:
		print(n - i)
		break


z = input()
list = [int(x) for x in input().split()]
n = 0
l = len(list)
for i in range(l):
	n += list[i]
k = 0
a = 0
while k <= n - k:
	k += max(list)
	list.remove(max(list))
	a += 1
print(a)


n = int(input())
coins = sorted(list(map(int, input().split())), reverse=True)
my_coins = 0
my_sum = 0
all_sum = sum(coins)
for c in coins:
	my_coins += 1
	my_sum += c
	if 2 * my_sum > all_sum:
		break
print(my_coins)


number_of_coins = int(input())
coins_value = sorted([int(x) for x in input().split()], reverse=True)
value_l = sum(coins_value) / 2
searched_value = 0
coins = 0
for i in coins_value:
	searched_value += i
	coins += 1
	if searched_value > value_l:
		break
	else:
		continue
print(coins)


n = int(input())
sum1 = sum2 = count = 0
A = list(map(int, input().split()))
max = 0
index = 0
A.sort(reverse=True)
for i in range(n):
	sum1 += A[i]
	count += 1
	for j in range(i + 1, n):
		sum2 += A[j]
	if sum1 > sum2:
		break
	else:
		sum2 = 0
print(count)


number_of_coins = int(input())
coins = list(map(lambda x: int(x), input().split()))
coins.sort(reverse=True)
counter = 1
(sum_me, sum_twin) = (coins[0], sum(coins[1:]))
while sum_me <= sum_twin:
	sum_me += coins[counter]
	sum_twin -= coins[counter]
	counter += 1
print(counter)


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
all_ = sum(coins)
greedy = 0
cnt = 0
for i in range(n):
	greedy += coins[i]
	all_ -= coins[i]
	cnt += 1
	if greedy - all_ > 0:
		print(cnt)
		break


n = int(input())
ls = [int(x) for x in input().split()]
ls.sort(reverse=True)
count = 0
mine = 0
his = 0
for x in ls:
	his += x
i = 0
while mine <= his:
	mine += ls[i]
	his -= ls[i]
	count += 1
	i += 1
print(count)


N = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
c = 0
acc = 0
s = sum(arr) / 2
for num in arr:
	c += 1
	acc += num
	if acc > s:
		break
print(c)


def f(s, s1, s2):
	if (s, s1, s2) in d:
		return d[s, s1, s2]
	if s1 > s2:
		d[s, s1, s2] = 0
		return d[s, s1, s2]
	elif s < 0:
		d[s, s1, s2] = float('inf')
		return d[s, s1, s2]
	else:
		x = 1 + f(s - 1, s1 + a[s], s2 - a[s])
		y = f(s - 1, s1, s2)
		d[s, s1, s2] = min(x, y)
		return d[s, s1, s2]
d = {}
n = int(input())
a = list(map(int, input().split()))
print(f(n - 1, 0, sum(a)))


a = int(input())
j = 1
p = 0
s = 0
d = 0
c = [int(i) for i in input().split()]
c = sorted(c)
p = sum(c)
for i in c[::-1]:
	s += i
	d += 1
	if s > p / 2:
		break
print(d)


n = int(input())
list = [int(x) for x in input().split()]
list.sort(reverse=True)
money = 0
coin = 0
total = sum(list)
i = 0
while money <= total / 2:
	money += list[i]
	coin += 1
	i += 1
print(coin)


import sys
import math
import bisect

def main():
	n = int(input())
	A = list(map(int, input().split()))
	A.sort(reverse=True)
	total = sum(A)
	val = 0
	for i in range(n):
		val += A[i]
		if val * 2 > total:
			print(i + 1)
			break
main()


n = int(input())
inp = list(map(int, input().split(' ')))
inp.sort()
inp.reverse()
s = 0
l = []
for i in range(0, len(inp)):
	s = s + inp[i]
	if s > sum(inp[i + 1:]):
		l.append(i + 1)
print(min(l))


n = int(input())
mon = sorted(list(map(int, input().split())), reverse=True)
s = sum(mon)
ans = 0
now = 0
for i in range(n):
	now += mon[i]
	ans += 1
	if now > s / 2:
		print(ans)
		break


z = input()
a = list(map(int, input().split()))
a.sort()
b = 0
for i in a:
	b += i
c = 0
d = 0
j = 1
while c <= b / 2:
	c += a[-j]
	j += 1
	d += 1
print(d)


input()
l = sorted(map(int, input().split()), reverse=1)
n = s = sum(l)
for i in range(99):
	s -= l[i]
	if s * 2 < n:
		print(i + 1)
		break


n = int(input())
a = list(map(int, input().split()))
aSum = sum(a) // 2
a.sort(reverse=True)
coin = 0
mycoin = 0
for i in range(len(a)):
	if mycoin > aSum:
		break
	else:
		mycoin += a[i]
		coin += 1
print(coin)


n = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
s = sum(arr) // 2
ans = 0
count = 0
for i in arr:
	if ans <= s:
		ans += i
		count += 1
	else:
		break
print(count)


count = int(input())
numbers = input()
number = numbers.split()
number = [int(x) for x in number]
number.sort(reverse=True)
sum = 0
for i in number:
	sum = sum + int(i)
if len(number) == 1:
	print(1)
else:
	half = 0
	z = 0
	while half <= sum / 2:
		half = half + int(number[z])
		z = z + 1
		if half > sum / 2:
			print(z)


input()
n = list(map(int, input().split()))
n.sort()
c = 0
s1 = 0
for f1 in range(len(n) - 1, -1, -1):
	c += 1
	s1 += n[f1]
	s2 = 0
	for f2 in range(f1):
		s2 += n[f2]
	if s1 > s2:
		print(c)
		break


n = int(input())
l = input().split()
l = [int(x) for x in l]
l.sort(reverse=True)
m = 0
j = 0
s = 0
for i in range(len(l)):
	s += int(l[i])
while m <= s / 2 and j <= len(l) - 1:
	m = m + int(l[j])
	j += 1
print(j)


n = int(input())
a = []
[a.append(int(x)) for x in input().split()]
count = int()
t = sum(a)
m = int()
a.sort(reverse=True)
for i in a:
	m += i
	count += 1
	if m > t - m:
		break
print(count)


n = int(input())
l = list(map(int, input().split()))
s = 0
cnt = 0
i = 0
l.sort(reverse=True)
while len(l) > 0:
	s = s + l[i]
	del l[i]
	k = sum(l)
	cnt = cnt + 1
	if s > k:
		break
print(cnt)


n = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
coin = totnow = 0
s = sum(arr)
while totnow <= s // 2:
	totnow += arr[coin]
	coin += 1
print(coin)


n = int(input())
x = input()
xx = x.split()
s = 0
for i in range(0, n):
	xx[i] = int(xx[i])
	s += xx[i]
xx.sort()
xx.reverse()
g = 0
f = 0
h = 0
while g <= f and h != n:
	g += xx[h]
	f = s - g
	h += 1
print(h)


n = int(input())
s = 0
a = input().split()
for i in range(n):
	s += int(a[i])
for i in range(n):
	for j in range(n - i - 1):
		if int(a[j]) < int(a[j + 1]):
			(a[j + 1], a[j]) = (a[j], a[j + 1])
t = 0
for i in range(n):
	t += int(a[i])
	if 2 * t > s:
		print(i + 1)
		break


input()
_input = sorted(list(map(int, input().split(' '))), reverse=True)
prefix_sum = [sum(_input[:i + 1]) for i in range(len(_input))]
total_sum = sum(_input)
for i in range(len(_input)):
	if prefix_sum[i] > total_sum - prefix_sum[i]:
		print(i + 1)
		break


n = int(input())
l = list(map(int, input().split()))
S = sum(l)
l.sort(reverse=True)
S1 = 0
k = 0
for i in range(n):
	k = k + 1
	S1 = S1 + l[i]
	S = S - l[i]
	if S1 > S:
		print(k)
		break


n = int(input())
a = list(map(int, input().split()))
a_sum = sum(a)
a.sort(reverse=True)
current = 0
for i in range(n):
	current += a[i]
	if current > a_sum - current:
		print(i + 1)
		break


input()
x = sorted(map(int, input().split()))
b = u = 0
while b <= sum(x):
	b += x.pop()
	u += 1
print(u)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
total = sum(a)
new = 0
count = 0
for i in a:
	new += i
	count += 1
	if new > total // 2:
		print(count)
		break


n = input()
coins = input().split()
coins = list(map(int, coins))
coins.sort(reverse=True)
count = 0
ownCoins = 0
avg = sum(coins) / 2
for coin in coins:
	ownCoins += coin
	count += 1
	if ownCoins > avg:
		break
print(count)


input()
coins = list(map(int, input().split()))
coins.sort()
total_sum = sum(coins)
current_sum = 0
for (count, coin) in enumerate(coins[::-1]):
	current_sum += coin
	total_sum -= coin
	if current_sum > total_sum:
		break
print(count + 1)


size = int(input())
arr = list(map(int, input().split()))
arr.sort()
sum = 0
for i in range(size):
	sum += arr[i]
count = 0
i = size - 1
no = 0
while count <= sum // 2:
	count += arr[i]
	no += 1
	i -= 1
print(no)


n = int(input())
astr = input()
a = astr.split()
coins = list(map(int, a))
coins.sort(reverse=True)
allcoins = 0
mycoins = 0
i = 0
for number in coins:
	allcoins = allcoins + number
while mycoins <= allcoins / 2:
	mycoins = mycoins + coins[i]
	i = i + 1
print(i)


n = int(input())
a = sorted([int(a) for a in input().split(' ')], reverse=True)
b = [a[0]]
for i in range(1, len(a)):
	b.append(b[i - 1] + a[i])
found = False
for i in range(len(b) - 1):
	if b[len(b) - 1] - b[i] < b[i]:
		print(i + 1)
		found = True
		break
if not found:
	print(len(a))


n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
b = []
ans = 0
while sum(a) >= sum(b):
	v = a.pop(0)
	b.append(v)
	ans += 1
print(ans)


n = input()
a = list(map(int, input().split()))
a.sort()
b = a[::-1]
k = sum(b)
j = 0
c = 0
while c <= k / 2:
	c += b[j]
	j += 1
print(j)


n = int(input())
l = sorted(list(map(int, input().split())))
l.reverse()
s = sum(l)
i = 0
p = 0
while p <= s // 2:
	p += l[i]
	i += 1
	if p > s // 2:
		ans = i
		break
print(i)


n = int(input().strip())
arr = list(map(int, input().strip().split()))
arr.sort(reverse=True)
s1 = sum(arr)
s2 = 0
i = 0
while True:
	if s2 <= s1 and i != n:
		s2 += arr[i]
		s1 -= arr[i]
		i += 1
	else:
		print(i)
		break


n = int(input())
num = 0
values = [int(x) for x in input().split()]
b = sorted(values, reverse=True)
y = sum(b) / 2
for i in range(n):
	num = num + b[i]
	if num > y:
		print(i + 1)
		break


m = int(input())
s = sorted(list(map(int, input().split())))
for i in range(1, m + 1):
	if sum(s[-i:]) > sum(s[0:-i]):
		print(len(s[-i:]))
		break


n = int(input())
l = list(map(int, input().split()))
s = 0
r = sum(l)
l.sort(reverse=True)
c = 1
for i in l:
	s = s + i
	r = r - i
	if s > r:
		break
	else:
		c += 1
print(c)


x = int(input())
length = x
arr = []
arr = list(map(int, input().split()))
arr = sorted(arr, reverse=True)
it = 1
coin = 1
total = arr[0]
arr.remove(arr[0])
while it != 0:
	if total > sum(arr):
		it = 0
		print(coin)
	else:
		total = total + max(arr)
		arr.remove(max(arr))
		coin += 1


x = int(input())
l = list(map(int, input().split()))
l.sort()
l = l[::-1]
t = sum(l)
k = set(l)
m = []
for i in range(0, x):
	if t < sum(m):
		break
	m.append(l[i])
	t = t - l[i]
print(len(m))


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
s1 = sum(l) / 2
s = 0
i = 0
while i < len(l):
	s = s + l[i]
	if s > s1:
		break
	i += 1
print(i + 1)


a = int(input())
lst = list(map(int, input().split()))
s = sum(lst)
t = s / 2
answer = 0
c = 0
lst = sorted(lst, reverse=True)
for i in lst:
	answer = answer + i
	c = c + 1
	if answer > t:
		break
print(c)


n = int(input())
a = list(map(int, input().split()))
m = 0
for i in range(1, n + 1):
	m = max(a) + m
	a.remove(max(a))
	if m > sum(a):
		print(i)
		break
	else:
		continue


n = int(input())
l = list(map(int, input().split(' ')))
l1 = sorted(l, reverse=True)
k = []
for i in range(len(l)):
	k.append(l1[i])
	if sum(k) > sum(l1[i + 1:]):
		break
print(len(k))


a = int(input())
lst = [int(i) for i in input().split()]
lst.sort(reverse=True)
s = 0
t = 0
n = 1
for i in lst:
	s += i
for j in lst:
	t += j
	n += 1
	if t > s / 2:
		b = n - 1
		break
print(b)


from sys import stdin

def lee():
	lon = int(stdin.readline())
	monedas = [int(x) for x in stdin.readline().split()]
	if lon == 1:
		print(1)
	else:
		monedas = quixk_sort(monedas)
		sumatoria = suma(monedas, lon)
		c = trampa(monedas, lon, sumatoria)
		print(c)

def suma(monedas, lon):
	c = 0
	sumatoria = 0
	while c < lon:
		n = monedas[c]
		sumatoria = sumatoria + n
		c += 1
	return sumatoria

def trampa(monedas, lon, sumatoria):
	c = 0
	suma_2 = sumatoria // 2
	lon = lon - 1
	sumatrampa = 0
	while lon >= 0:
		n = monedas[lon]
		sumatrampa = sumatrampa + n
		c += 1
		lon -= 1
		if sumatrampa > suma_2:
			return c

def partitition(lista):
	(pivote, menores, mayores) = (lista[0], [], [])
	for x in range(1, len(lista)):
		if lista[x] < pivote:
			menores.append(lista[x])
		else:
			mayores.append(lista[x])
	return (menores, [pivote], mayores)

def quixk_sort(lista):
	if len(lista) < 2:
		return lista
	else:
		(menores, medio, mayores) = partitition(lista)
	return quixk_sort(menores) + medio + quixk_sort(mayores)
lee()


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
s = 1
while True:
	if sum(a[-s:]) > sum(a[:n - s]):
		break
	s += 1
print(s)


noOfCoins = int(input())
coins = [int(i) for i in input().split()]
total = 0
count = 0
while True:
	now = max(coins)
	nowIndex = coins.index(now)
	total += now
	coins.remove(now)
	if total > sum(coins):
		count += 1
		print(count)
		exit()
	else:
		count += 1


t = int(input())
li = sorted(list(map(int, input().split())))[::-1]
(curr_sm, sm) = (0, sum(li))
for i in range(t):
	curr_sm += li[i]
	sm -= li[i]
	if curr_sm > sm:
		print(i + 1)
		break


n = int(input())
lst = 0
s = input()
lst = s.split()
lst = [int(i) for i in lst]
h = sum(lst) // 2 + 1
lst.sort()
lst.reverse()
sum = 0
cnt = 0
for x in lst:
	sum += x
	cnt += 1
	if sum >= h:
		break
print(cnt)


n = int(input())
s = input().split()
s1 = list(map(int, s))
s1.sort()
c = 0
k = len(s1) - 1
a = 0
b = 1
j = 0
while a <= b:
	a += s1[k]
	j += 1
	b = 0
	for i in range(len(s1) - j):
		b += s1[i]
	c += 1
	k -= 1
print(c)


n = int(input())
a = [0 for i in range(100)]
s = input()
xi = 0
i = 0
while i < len(s):
	if s[i] == ' ':
		i += 1
	else:
		x = ''
		while s[i] != ' ':
			x = x + s[i]
			i += 1
			if i >= len(s):
				break
		a[xi] = int(x)
		xi += 1
for i in range(n):
	for j in range(i + 1, n):
		if a[i] < a[j]:
			t = a[i]
			a[i] = a[j]
			a[j] = t
sum = 0
for i in range(n):
	sum = sum + a[i]
s = 0
i = 0
while s * 2 <= sum:
	s = s + a[i]
	i += 1
print(i)


import sys
inf = sys.stdin
coins = int(inf.readline())
temp = inf.readline()
values = [int(i) for i in temp.split(' ')]
total = 0
counter = 0
while total <= sum(values):
	counter += 1
	highest = max(values)
	total += highest
	values.remove(highest)
print(counter)


n = int(input())
A = list(map(int, input().split()))
out = 1
s = max(A)
A.remove(max(A))
while s <= sum(A):
	s += max(A)
	A.remove(max(A))
	out += 1
print(out)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
cs = 0
s = sum(a)
count = 0
for i in range(len(a)):
	cs += a[i]
	s = s - a[i]
	count += 1
	if cs > s:
		break
print(count)


countt = 1
back = 0
t = 0

def f(l):
	global countt, back, t
	summ = 0
	l = sorted(l)
	back = back + l[len(l) - 1]
	for i in range(len(l) - 1):
		summ = summ + l[i]
	t += 1
	if len(l) == 1 and t == 1:
		return 1
	if len(l) == 1 and t != 1:
		return countt
	if back > summ:
		return countt
	else:
		countt += 1
		return f(l[:len(l) - 1])
n = int(input())
l = list(map(int, input().split()))
print(f(l))


n = int(input())
a = sorted(list(map(int, input().split())))
mid = sum(a) // 2
(cnt, add) = (0, 0)
for i in a:
	add += i
	cnt += 1
	if add > mid:
		break
(cnt1, add1) = (0, 0)
for i in range(n - 1, -1, -1):
	add1 += a[i]
	cnt1 += 1
	if add1 > mid:
		break
print(min(cnt, cnt1))


n = int(input())
a = list(map(int, input().split()))
total = 0
for i in a:
	total += i
a.sort(reverse=True)
tot = 0
count = 0
half = total // 2
for i in a:
	if tot > half:
		break
	tot += i
	count += 1
print(count)


n = int(input())
p = input().split()
l = list(map(int, p))
l.sort(reverse=True)
if n == 1:
	print(1)
else:
	for i in range(n):
		if sum(l[:i + 1]) > sum(l[i + 1:]):
			pos = i + 1
			break
	print(pos)


n = int(input())
a = [int(k) for k in input().split(' ')]
a.sort()
a.reverse()
minkash = 0
while 2 * sum(a[:minkash]) <= sum(a):
	minkash += 1
print(minkash)


n = int(input())
arr = list(map(int, input().split()))
s = sum(arr)
c = su = 0
for i in range(n):
	for j in range(n - i - 1):
		if arr[j] > arr[j + 1]:
			(arr[j], arr[j + 1]) = (arr[j + 1], arr[j])
	su += arr[-1 - i]
	c += 1
	if su > s - su:
		break
print(c)


(n, a) = (input(), input().split())
a = [int(x) for x in a]
x = sum(a) // 2
a.sort(reverse=True)
(ss, ans) = (0, 0)
for e in a:
	ss = ss + int(e)
	ans = ans + 1
	if ss > x:
		print(ans)
		break


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
total = 0
for x in coins:
	total += x
sum = 0
i = 0
while sum <= total / 2:
	sum += coins[i]
	i += 1
print(i)


n = int(input())
a = list(map(int, input().split()))
a.sort()
a = a[::-1]
b = []
t = 0
for i in range(len(a)):
	if t == 0:
		if sum(b) > sum(a) / 2:
			b[-1] = a[i]
			t = 1
		else:
			b.append(a[i])
	elif t == 1:
		if sum(b) > sum(a) / 2:
			b[-1] = a[i]
		else:
			break
print(len(b))


n = int(input())
t = [int(i) for i in input().split()]
t.sort()
t.reverse()
ans = sum(t)
fin = 0
ch = sum(t) / 2
for i in range(len(t)):
	ans -= t[i]
	fin += 1
	if ans < ch:
		break
print(fin)


n = int(input())
a = list(map(int, input().split()))
a.sort()
s = sum(a)
for i in range(n):
	e = sum(a[::-1][:i + 1])
	if e > s / 2:
		print(i + 1)
		break


a = int(input())
b = list(map(int, input().strip().split()))
b.sort(reverse=True)
c = sum(b)
i = 0
while 1 > 0:
	s = sum(b[:i])
	if s * 2 > c:
		break
	i = i + 1
print(i)


l = int(input())
ip = list(map(int, input().split()))
ip.sort(reverse=True)
i = 0
count = 0
suma = 0
while i < l:
	suma = suma + ip[i]
	count = count + 1
	if suma > sum(ip[i + 1:]):
		break
	i += 1
print(count)


n = int(input())
ls = list(map(int, input().split()))
ls.sort()
ls.reverse()
s = 0
p = 0
q = 0
for i in ls:
	s += i
for j in ls:
	p = p + 1
	q = q + j
	if q > s // 2:
		break
print(p)


n = int(input())
a = sorted(list(map(int, input().split())))
kil = 0
(su1, su2) = (sum(a), 0)
for i in range(n - 1, -1, -1):
	if su1 >= su2:
		kil += 1
		su1 -= a[i]
		su2 += a[i]
print(kil)


input()
coins = list(map(int, input().split(' ')))
coins.sort()
tot = sum(coins)
my = 0
idx = len(coins) - 1
count = 0
while idx >= 0 and my <= tot:
	my += coins[idx]
	tot -= coins[idx]
	idx -= 1
	count += 1
print(count)


n = int(input())
s = list(map(int, input().strip().split()))
t = sum(s)
s.sort(reverse=True)
c = 1
m = 0
for i in range(n):
	m = m + s[i]
	if m > t / 2:
		break
	else:
		c = c + 1
print(c)


n = int(input())
l2 = input().split()
coins = [int(x) for x in l2]
sort_coins = sorted(coins, reverse=True)
s = sum(sort_coins)
val = s // 2
up = 0
for i in range(len(sort_coins)):
	up += sort_coins[i]
	if up > val:
		print(i + 1)
		break


def twins():
	num_coins = int(input())
	coins_array = input()
	coins_array = coins_array.split()
	for j in range(len(coins_array)):
		coins_array[j] = int(coins_array[j])
	my_coins = []
	my_sum = sum(my_coins)
	their_sum = sum(coins_array)
	while True:
		if my_sum <= their_sum:
			max_coin = max(coins_array)
			coins_array.remove(max_coin)
			my_coins.append(max_coin)
			my_sum = sum(my_coins)
			their_sum = sum(coins_array)
		else:
			return len(my_coins)
print(twins())


n = int(input())
s = sorted(list(map(int, input().split())), reverse=True)
for i in range(1, n + 1):
	if sum(s[0:i]) > sum(s[i:len(s)]):
		print(i)
		break


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
m = []
k = 0
for i in range(len(l)):
	if sum(m) > sum(l):
		print(k)
		break
	else:
		a = l.pop(0)
		m.append(a)
		k = k + 1
if k == n:
	print(n)


n = int(input())
a = list(map(int, input().split()))
a.sort()
sum1 = 0
sum2 = 0
i = 0
while 1:
	sum1 = sum(a[0:len(a) - i])
	sum2 = sum(a[len(a) - i:len(a)])
	if sum2 > sum1:
		break
	i += 1
print(i)


n = int(input())
li = sorted(map(int, input().split()))
li.reverse()
sum = 0
sum0 = 0
for i in range(n):
	sum += li[i]
for m in range(n):
	sum0 += li[m]
	if sum0 > sum / 2:
		print(m + 1)
		break


n = int(input())
ai = list(map(int, input().split()))
s = 0
sum = 0
cpt = 0
for i in range(n):
	s += ai[i]
a = sorted(ai)
for i in range(n):
	if sum > s / 2:
		break
	else:
		sum += a[n - i - 1]
		cpt += 1
print(cpt)


n = int(input())
x = list(map(int, input().split()))
m = 0
i = 0
while 1:
	i += 1
	a = max(x)
	m += a
	x.remove(a)
	b = sum(x)
	if m > b:
		break
print(i)


a = int(input())
b = [int(i) for i in input().split()]
b = sorted(b)
for i in range(a, -1, -1):
	if sum(b[0:i]) < sum(b[i:a]):
		print(len(b[i:a]))
		break


n = int(input())
coinValues = []

def Sum123(list):
	sum1 = 0
	for i in range(0, len(list)):
		sum1 = sum1 + list[i]
	return sum1
coinValues = list(map(int, input().split()))
coinValues.sort(key=int, reverse=True)
sum = 0
for i in range(0, len(coinValues)):
	sum += coinValues[i]
	sumOfTheRestOfTheArray = Sum123(coinValues[i + 1:])
	if sum > sumOfTheRestOfTheArray:
		print(i + 1)
		break


n = int(input())
s = list(map(int, input().split()))
c = 1
s.sort(reverse=True)
if n == 1:
	print('1')
	exit()
elif n == 2:
	if max(s) == min(s):
		print('2')
	else:
		print('1')
	exit()
for i in range(n - 1):
	if sum(s[0:i + 1]) <= sum(s[i + 1:n]):
		c += 1
	else:
		print(c)
		exit()


n = int(input())
line = [int(i) for i in input().split()]
a = sum(line)
line.sort(reverse=True)
num = 0
for i in range(n):
	if sum(line[0:i + 1]) <= a / 2:
		num += 1
		continue
	else:
		print(num + 1)
		break


def twins(arr, n):
	(arr, x) = (sorted(arr)[::-1], 2)
	(temp, tem) = ([arr[0]], arr[1:])
	while sum(temp) <= sum(tem):
		temp = arr[:x]
		tem = arr[x:]
		x += 1
	return len(temp)
n = input()
arr = list(map(int, input().split()))
print(twins(arr, n))


import math
n = int(input())
coins = input().split(' ')
coins = sorted([int(_) for _ in coins])[::-1]
total = sum(coins)
thresh = total // 2 + 1
sum_own = 0
i = 0
while sum_own < thresh and i < n:
	sum_own += coins[i]
	i += 1
print(i)


def solve():
	n = int(input())
	a = sorted([int(i) for i in input().split()], reverse=True)
	sall = sum(a)
	(ans, st) = (0, 0)
	for i in a:
		st += i
		ans += 1
		if st > sall / 2:
			break
	print(ans)
solve()


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
(low, high) = (1, len(l))
while low < high:
	mid = int((low + high) / 2)
	if sum(l[:mid]) <= sum(l[mid:]):
		low = mid + 1
	else:
		high = mid
print(low)


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
c = 0
for i in range(n):
	if sum(coins[:i]) > sum(coins[i:]):
		break
	c += 1
print(c)


def findMinCoins(ar):
	ar.sort()
	total_sum = sum(ar)
	cur_sum = 0
	c = 0
	for i in range(len(ar) - 1, -1, -1):
		cur_sum += ar[i]
		c += 1
		if cur_sum > total_sum - cur_sum:
			print(c)
			return
n = int(input())
mycoins = list(map(int, input().split()))
findMinCoins(mycoins)


import sys
from math import floor

def calculate(coins):
	min_value = floor(sum(coins) / 2.0)
	selected_coins = []
	coins.sort(reverse=True)
	for coin in coins:
		if sum(selected_coins) > min_value:
			return len(selected_coins)
		else:
			selected_coins.append(coin)
	return len(selected_coins)
n = input()
coins = list(map(lambda x: int(x), input().split()))
min_coins = calculate(coins)
print(min_coins)


n = int(input())
m = [int(x) for x in input().split()]
m = sorted(m)
s = 0
t = n - 1
a = 0
for i in range(0, n):
	s = s + m[i]
while a <= s - a:
	a = a + m[t]
	t -= 1
print(n - 1 - t)


n = int(input())
x = input()
t = x.split()
m = 0
for i in range(n):
	t[i] = int(t[i])
	m = m + t[i]
t.sort(reverse=True)
m = int(m / 2) + 1
k = 0
l = 0
while k < n:
	l = l + t[k]
	k = k + 1
	if l >= m:
		break
print(k)


n = int(input())
list = []
i = n
c = 1
list = [int(x) for x in input().split()]
list.sort()
m = list[len(list) - 1]
j = len(list) - 2
while j >= 0:
	if m <= sum(list[:j + 1]):
		m = m + list[j]
		c = c + 1
	elif m > sum(list[:j]):
		break
	j = j - 1
print(c)


minimum_coin = 0
current_sum = 0
numcoins = int(input())
coinvalues = list(map(int, input().split()))
coinvalues.sort()
while current_sum <= sum(coinvalues):
	minimum_coin += 1
	current_sum += coinvalues.pop()
print(minimum_coin)


n = int(input())
arr = [int(i) for i in input().split()]
arr.sort()
ma = sum(arr)
mi = 0
amount = 0
for i in range(n):
	amount += arr[n - i - 1]
	mi += 1
	if amount > ma - amount:
		break
print(mi)


input()

def s():
	a = sorted(map(int, input().split()))[::-1]
	for i in range(len(a)):
		if sum(a[:i]) > sum(a[i:]):
			return i
	return len(a)
print(s())


inp = input()
n = int(inp)
V = input()
x = [0] * 100000
val = V.split(' ')
val.sort()
for i in range(n):
	x[i] = int(val[i])
sum = 0
sum1 = 0
number = 0
x.sort()
for i in range(n):
	sum = sum + int(val[i])
for i in range(n):
	sum1 = sum1 + x[-i - 1]
	number = number + 1
	if sum1 > 0.5 * sum:
		break
print(number)


from sys import stdin, stdout, stderr, setrecursionlimit
setrecursionlimit(100000)

def debug(*e):
	if not __debug__:
		print(*e, file=stderr)

def dd(*vals):
	import inspect, re
	frame = inspect.getframeinfo(inspect.stack()[1][0])
	vs = re.search('dd\\((.+)\\)', frame.code_context[0]).group(1).split(',')
	if vs:
		debug(','.join(('{0} = {1}'.format(vs[i], v) for (i, v) in enumerate(vals))))

def trace(f):

	def traced(*args, **kw):
		debug('calling {} with args {}, {}'.format(f.__name__, args, kw))
		return f(*args, **kw)
	return traced

def read():
	return stdin.readline().rstrip()

def readarr(sep=None, maxsplit=-1):
	return read().split(sep, maxsplit)

def readint():
	return int(read())

def readintarr(sep=None, maxsplit=-1):
	return [int(a) for a in readarr(sep, maxsplit)]

def write(*args, **kwargs):
	sep = kwargs.get('sep', ' ')
	end = kwargs.get('end', '\n')
	stdout.write(sep.join((str(a) for a in args)) + end)

def writearr(arr, sep=' ', end='\n'):
	stdout.write(sep.join((str(a) for a in arr)) + end)
n = readint()
xs = sorted(readintarr(), reverse=True)
limit = sum(xs) / 2
s = 0
r = 0
for (i, x) in enumerate(xs):
	s += x
	if s > limit:
		r = i + 1
		break
write(r)


x = int(input())
lst = list(map(int, input().split()))
lst.sort(reverse=True)
f = 0
for i in range(x + 1):
	lst1 = lst[0:i]
	lst2 = lst[i:]
	if sum(lst1) > sum(lst2):
		f = i
		break
print(i)


from sys import stdin, stdout

def main():
	n = stdin.readline()
	l = sorted([int(number) for number in stdin.readline().split()], reverse=True)
	index = 1
	while sum(l[:index]) <= sum(l[index:]):
		index += 1
	stdout.write(str(len(l[:index])))
main()


(a, arr) = (int(input()), list(map(int, input().strip().split())))
(b, c) = (sum(arr), 0)
arr.sort(reverse=True)
ans = 0
for m in arr:
	ans += 1
	c += m
	if c > b / 2:
		break
print(ans)


from sys import stdin, stdout
from math import inf

def main():
	n = int(stdin.readline())
	coins = list(map(int, stdin.readline().split()))
	total_value = sum(coins)
	coins.sort(reverse=True)
	minimum_coins = 0
	my_amount = 0
	for coin in coins:
		if my_amount > total_value:
			break
		total_value -= coin
		my_amount += coin
		minimum_coins += 1
	stdout.write(f'{minimum_coins}\n')
main()


def Twins():
	x = int(input())
	l = list(input().split(' '))
	l = sorted(list(map(int, l)), reverse=True)
	s = 0
	for i in range(len(l)):
		s += l[i]
		if s > sum(l[i + 1:len(l)]):
			print(i + 1)
			break
Twins()


x = int(input())
y = list(map(int, input().split(' ')))
y.sort(reverse=True)
s = y[0]
counter = 1
for i in range(len(y)):
	if s > sum(y[i + 1:]):
		print(counter)
		break
	else:
		s += y[i + 1]
		counter += 1


n = int(input())
arr = list(map(int, input().split()))
s = sum(arr)
arr = sorted(arr)
temp = 0
c = 0
for i in range(n - 1, -1, -1):
	c += 1
	temp += arr[i]
	s -= arr[i]
	if temp > s:
		break
print(c)


n = input()
v = list(map(int, input().split()))
v.sort()
i = len(v) - 1
s = sum(v)
metade = s / 2
s2 = 0
c = 0
while metade >= s2:
	s2 += v[i]
	c += 1
	i -= 1
print(c)


n = int(input())
coins = [int(x) for x in input().split()]
the_sum = 0
count = 0
while len(coins) > 0 and the_sum <= sum(coins):
	current_coin = max(coins)
	the_sum += current_coin
	del coins[coins.index(current_coin)]
	count += 1
print(count)


n = int(input())
coins = input().split()
coins_int = [int(n) for n in coins]
coins_int.sort()
coins_int.reverse()
all_coins = sum(coins_int)
take_coins = 0
for (i, coin) in enumerate(coins_int):
	take_coins += coin
	if take_coins > all_coins - take_coins:
		print(i + 1)
		break


def twins_coins(coins_list, sum_of_coins):
	temp_sum = 0
	min_coins = 0
	for each_coin in coins_list:
		min_coins += 1
		temp_sum += each_coin
		if temp_sum > sum_of_coins - temp_sum:
			return min_coins
coins_list = []
sum_of_coins = 0
number_of_coins = int(input())
if number_of_coins == 1:
	print('1')
else:
	coins_values = map(int, input().split(' '))
	for each_coin in coins_values:
		sum_of_coins += each_coin
		coins_list.append(each_coin)
	coins_list.sort(reverse=True)
	print(twins_coins(coins_list, sum_of_coins))


a = int(input())
list1 = [int(x) for x in input().split()]
list2 = list(reversed(sorted(list1)))
for i in range(1, a + 1):
	if sum(list2[0:i]) > sum(list2) / 2:
		print(i)
		break


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
s = 0
for i in range(len(a)):
	s += a[i]
min = int(s / 2) + 1
(coll, j) = (0, 0)
while coll < min:
	coll += a[j]
	j += 1
print(j)


n = int(input())
a = list(map(int, input().split()))
a.sort()
pre = [0] * (n + 1)
s = sum(a)
for i in range(1, n + 1):
	pre[i] = a[i - 1] + pre[i - 1]
i = n
while i >= 0:
	if pre[i] < s - pre[i]:
		break
	i -= 1
print(n - i)


n = int(input())
x = sorted([int(x) for x in input().split()], reverse=True)
sum = 0
for i in x:
	sum += i
sum /= 2
sum2 = 0
i = 0
while sum2 <= sum:
	sum2 += x[i]
	i += 1
print(i)


n = int(input())
a = [int(x) for x in input().split()]
b = list(a)
b.sort()
b.reverse()
sum = 0
for i in b:
	sum += i
num = 0
sum1 = 0
for i in b:
	if sum1 <= sum // 2:
		sum1 += i
		num += 1
print(num)


amount = int(input())
coins = [int(x) for x in input().split(' ')]
coins.sort(reverse=True)

def foo():
	for i in range(amount):
		if sum(coins[:i + 1]) > sum(coins[i + 1:]):
			return i + 1
print(foo())


n = int(input())
a = []
sum = 0
for x in input().split():
	a.append(int(x))
	sum += int(x)
a.sort()
a = list(reversed(a))
i = 0
cur = 0
while cur <= sum // 2:
	cur += a[i]
	i += 1
print(i)


(n, my_money, result) = (int(input()), 0, 0)
coins = sorted([int(i) for i in input().split()], reverse=True)
brother_money = sum(coins)
for coin in coins:
	if my_money <= brother_money:
		my_money += coin
		brother_money -= coin
		result += 1
	else:
		break
print(result)


n = int(input())
l = list(map(int, input().split(' ')))
l.sort()
number = 0
tot = 0
i = 0
for f in l[::-1]:
	if tot > sum(l[:len(l) - i]):
		break
	tot += f
	number += 1
	i += 1
print(number)


n = int(input())
arr = list(map(int, input().split()))
arr = list(reversed(sorted(arr)))
total = sum(arr)
cur = 0
cnt = 0
for coin in arr:
	cur += coin
	cnt += 1
	if cur > total / 2:
		break
print(cnt)


import math
s = input()
arr = list(map(int, input().split()))
arr = sorted(arr, reverse=True)
(s, count, temp) = (sum(arr), 0, 0)
for i in arr:
	temp += i
	count += 1
	if temp > s - temp:
		break
print(count)


a = int(input())
b = sorted(list(map(int, input().split())))
b.reverse()
coin = 0
total = int(sum(b) / 2)
c_sum = 0
for i in b:
	if c_sum <= total:
		c_sum += i
		coin += 1
	else:
		continue
print(coin)


n = int(input())
x = [int(x) for x in input().split()]
x.sort(reverse=True)
s = sum(x)
ans = 0
count = 0
for item in x:
	ans += item
	count += 1
	if ans > s / 2:
		break
	else:
		continue
print(count)


n = int(input())
v_li = input().split(' ')
v_li2 = sorted(map(int, v_li))
s = 0
a = 0
while s <= sum(v_li2):
	s += v_li2[-1]
	v_li2 = v_li2[:-1]
	a += 1
print(a)


n = int(input())
coins = [int(j) for j in input().split()]
coins.sort()
for i in range(n):
	if sum(coins[:i + 1]) >= sum(coins[i + 1:n]):
		break
print(n - i)


from math import floor
input()
a = [int(x) for x in input().split()]
total = sum(a)
a.sort(reverse=True)
n = 0
my_total = 0
for coin in a:
	n += 1
	my_total += coin
	if my_total > floor(total / 2):
		break
print(n)


p = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
s = sum(a)
for i in range(len(a) + 1):
	if sum(a[:i]) > s // 2:
		break
print(i)


count = 0
n = int(input())
c = sorted(list(map(int, input().split())), reverse=True)
Remain = sum(c)
Coin = 0
for i in range(0, n):
	if Coin <= Remain:
		count += 1
		Coin += c[i]
		Remain -= c[i]
	else:
		break
print(count)


n = int(input())
l = []
l = list(map(int, input().split()))
l.sort()
hisvalue = 0
for i in l:
	hisvalue += i
myvalue = 0
coins = 0
for i in range(n - 1, -1, -1):
	if myvalue <= hisvalue:
		myvalue += l[i]
		coins += 1
		hisvalue -= l[i]
	else:
		break
print(coins)


size = int(input())
string = input()
coins = string.split(' ')
for i in range(size):
	coins[i] = int(coins[i])
coins.sort()
minimun = 0
num = 0
for i in range(size):
	if sum(coins[0:size - i]) >= minimun:
		minimun += coins[size - 1 - i]
		num += 1
print(num)


num = int(input())
count = myshare = 0
list = []
str = input()
str1 = str.split()
for x in range(0, num):
	list.append(int(str1[x]))
list.sort()
while True:
	myshare += list.pop()
	count += 1
	sum = 0
	for x in range(len(list)):
		sum += list[x]
	if sum < myshare:
		break
print(count)


x = int(input())
d = 0
c = 0
a = [int(x) for x in input().split()]
a.sort()
s = sum(a)
for i in range(1, len(a) + 1):
	d = d + a[-i]
	s = s - a[-i]
	if d <= s:
		c += 1
	else:
		break
print(c + 1)


n = int(input())
l = list(map(int, input().split()))
(a, b) = (0, 0)
while True:
	a += max(l)
	l.remove(max(l))
	b += 1
	if a > sum(l):
		break
print(b)


numberOfCoins = input()
coinValues = input()
coinValues = coinValues.split(' ')
for i in range(len(coinValues)):
	coinValues[i] = int(coinValues[i])
coinValues.sort(reverse=True)
sumOfCoins = 0
biggerPile = 0
biggerPileNoCoins = 0
for item in coinValues:
	sumOfCoins += int(item)
if len(coinValues) == 1:
	biggerPileNoCoins = 1
else:
	for item in coinValues:
		biggerPile += int(item)
		biggerPileNoCoins += 1
		if biggerPile > sumOfCoins // 2:
			break
print(biggerPileNoCoins)


n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
current_sum = 0
for i in range(n):
	current_sum += a[i]
	if current_sum > sum(a[i + 1:]):
		print(i + 1)
		exit()


n = int(input())
l = list(map(int, input().split()))
l.sort()
k = 0
j = 0
for i in l[::-1]:
	k += i
	j -= 1
	if k > sum(l) / 2:
		c = j
		break
print(-j)


x = int(input())
a = [int(i) for i in input().split()]
z = sum(a)
a = sorted(a, reverse=True)
x = 0
y = 0
for i in a:
	if x > z - x:
		break
	x += i
	y += 1
print(y)


n = int(input())
a = list(map(int, input().strip().split()))
a.sort(reverse=True)
s = sum(a)
b = 0
c = 0
for x in a:
	b += x
	c += 1
	if b > s / 2:
		break
print(c)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
b = sum(a) // 2
i = n - 1
k = 1
s = a[n - 1]
while s <= b:
	i -= 1
	k += 1
	s += a[i]
print(k)


input()
s = input().split()
coins = []
for i in s:
	coins.append(int(i))
coins.sort()
coins.reverse()
coinSum = sum(coins)
ctr = 0
getSum = 0
while getSum < coinSum // 2 + 1:
	getSum += coins[ctr]
	ctr += 1
print(ctr)


n = int(input())
s = [int(j) for j in input().split()]
s.sort()
v = s[::-1]
c = 0
p = 1
d = 0
for i in range(len(s)):
	c = c + s[i]
for i in range(len(v)):
	d = d + v[i]
	if d <= c // 2:
		p += 1
print(p)


coins = eval(input())
values = input()
values = [int(i) for i in values.split()]
values.sort(reverse=True)
total = 0
minimum = 0
for e in values:
	total += e
for e in range(coins):
	minimum += values[e]
	if minimum > total / 2:
		print(e + 1)
		exit()


n = int(input())
coi = map(int, input().split(' '))
coin = []
for k in coi:
	coin.append(k)
summ = 0
for i in coin:
	summ += i
coin.sort(reverse=True)
count = 0
taken = 0
for k in coin:
	summ -= k
	taken += k
	count += 1
	if taken > summ:
		break
print(count)


n = int(input())
l1 = list(map(int, input().split(' ')))
sum1 = 0
for i in l1:
	sum1 += i
sum2 = 0
i = 0
while sum1 >= sum2:
	maxnum = max(l1)
	sum1 -= maxnum
	sum2 += maxnum
	l1.remove(maxnum)
	i += 1
print(i)


import sys
inf = float('inf')
mod = 1000000007

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

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

def input():
	return sys.stdin.readline()

def int1():
	return int(input())
n = int1()
a = get_array()
a.sort(reverse=True)
s1 = sum(a)
s2 = s1 / 2
i = 0
while i < n:
	l = a[:i + 1]
	if s2 < sum(l):
		break
	i = i + 1
print(len(l))


n = int(input())
coins = [int(x) for x in input().split()]
l = []
while sum(l) <= sum(coins):
	a = max(coins)
	l.append(a)
	coins.remove(a)
print(len(l))


n = int(input())
coins = list(map(int, input().rstrip().rsplit()))
coins.sort()
s = sum(coins)
s = s // 2
coins.reverse()
c = 0
x = 0
for i in coins:
	if c <= s:
		c = c + i
		x = x + 1
print(x)


n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
s = sum(a)
t = ans = i = 0
while i < n and t <= s - t:
	t += a[i]
	i += 1
	ans += 1
print(ans)


N = int(input())
A = list(map(int, input().split()))
suma = sum(A)
A.sort(reverse=True)
count = 0
temp = 0
for i in range(N):
	if temp <= suma // 2:
		temp += A[i]
		count += 1
	else:
		break
print(count)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
s = 0
for i in a:
	s += i
s1 = 0
k = 0
while s1 <= s:
	s1 += a[k]
	s -= a[k]
	k += 1
print(k)


import sys
inputCount = input()
inputCoins = input()
coinQ = []
for i in inputCoins.split(' '):
	coinQ.append(int(i))
count = 1
result = 0
coinQ.sort()
while count < len(coinQ):
	if sum(coinQ[-count:]) > sum(coinQ[0:len(coinQ) - count]):
		print(count)
		sys.exit()
	count += 1
print(len(coinQ))


n = int(input())
L = list(map(int, input().split()))
L.sort()
s = c = 0
while s <= sum(L):
	s = s + L.pop()
	c = c + 1
print(c)


num = input()
coins_iter = sorted(map(int, input().split(' ')), reverse=True)
maj_coins = sum(coins_iter)
running = 0
count = 0
for i in coins_iter:
	if running > maj_coins:
		break
	else:
		running += int(i)
		maj_coins -= int(i)
		count += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
s1 = 0
s2 = sum(a)
for (i, ai) in enumerate(a):
	s1 += ai
	s2 -= ai
	if s1 > s2:
		print(i + 1)
		exit()


n = int(input())
m = [int(x) for x in input().split()]
m.sort(reverse=True)
(suma, cantidad) = (0, 0)
total = sum(m) / 2
for k in m:
	suma += k
	cantidad += 1
	if suma > total:
		print(cantidad)
		break


n = int(input())
a = [int(k) for k in input().split()]
for i in range(n - 1):
	for j in range(n - 1 - i):
		if a[j] < a[j + 1]:
			(a[j], a[j + 1]) = (a[j + 1], a[j])
s = sum(a) // 2
(s1, kol) = (0, 0)
for i in range(n):
	if s1 <= s:
		s1 += a[i]
		kol += 1
	else:
		break
print(kol)


n = int(input())
inp = list(map(int, input().split()))
inp.sort(reverse=True)
res = 0
s = 0
while s <= sum(inp):
	s += inp[0]
	res += 1
	inp.pop(0)
print(res)


n = int(input())
b = [x for x in input().split()]
c = []
sum1 = 0
for i in range(n):
	c.append(int(b[i]))
	sum1 += int(b[i])
c.sort(reverse=True)
t = 0
qwe = 0
while t < n:
	qwe += c[t]
	if qwe > sum1 / 2:
		print(t + 1)
		break
	t = t + 1


a = input()
b = input()
y = b.split()
x = []
for u in y:
	x.append(int(u))
x.sort()
x.reverse()
i = 0
sum1 = 0
while i >= 0:
	sum1 += int(x[i])
	if sum1 > sum(x[i + 1:]):
		print(str(i + 1))
		break
	i = i + 1


n = int(input())
coins = [int(x) for x in input().split()]
coins.sort(reverse=True)
(me, bro) = (0, sum(coins))
i = 0
while me <= bro and i <= n - 1:
	me += coins[i]
	bro -= coins[i]
	i += 1
print(i)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
b = 0
i = 0
while b <= sum(a[i:]):
	b += a[i]
	i += 1
	if i == n + 1:
		break
print(i)


n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
(temp, s, ans) = (0, sum(a), 0)
for i in range(n):
	temp += a[i]
	ans += 1
	if temp > s - temp:
		break
print(ans)


n = int(input())
x = list(map(int, input().split()))
x.sort(reverse=True)
total = x[0]
ctr = 1
for i in range(1, len(x)):
	if total > sum(x[i:]):
		break
	else:
		total += x[i]
		ctr += 1
		if total > sum(x[i:]):
			break
print(ctr)


coins = int(input())
values = [int(i) for i in input().split(' ')]
values.sort()
max_allowed = sum(values) // 2
result = 0
cur = 0
while cur <= max_allowed:
	result += 1
	cur += values[len(values) - 1]
	del values[len(values) - 1]
print(result)


num = int(input())
coins = [int(s) for s in input().split(' ')]
coins = sorted(coins)[::-1]
found = False
for i in range(num):
	if sum(coins[:i + 1]) - sum(coins[i + 1:]) > 0:
		dif = len(coins[:i + 1])
		break
print(dif)


def monedas(a, n):
	suma = 0
	m = 0
	for i in range(1, len(a) + 1):
		suma += a[-i]
		m += 1
		if suma >= n:
			return m
n = int(input())
a = list(map(int, input().split()))
a.sort()
s = sum(a) // 2 + 1
print(monedas(a, s))


import sys
input()
nbs = sorted(map(int, sys.stdin.readline().split()))
total = sum(nbs) // 2 + 1
nb = 0
ptotal = 0
for i in nbs[::-1]:
	ptotal += i
	nb += 1
	if ptotal >= total:
		break
print(nb)


n = int(input())
listOfCoins = list(map(int, input().split()))
sumOfOriginalCoins = 0
for coin in listOfCoins:
	sumOfOriginalCoins = sumOfOriginalCoins + coin
sortedList = sorted(listOfCoins)
listOfCoinsITake = []
totalValueOfMyCoins = 0
for i in range(n):
	listOfCoinsITake.append(sortedList[n - i - 1])
	totalValueOfMyCoins = totalValueOfMyCoins + sortedList[n - i - 1]
	if totalValueOfMyCoins > sumOfOriginalCoins / 2:
		break
answer = len(listOfCoinsITake)
print(answer)


n = int(input())
a = map(int, input().split())
a = list(a)
a.sort()
x = 0
y = 0
val = 0
for i in range(len(a)):
	val = val + a[i]
for i in range(len(a) - 1, -1, -1):
	if x <= val / 2:
		x = x + a[i]
		y = i
	else:
		break
print(len(a) - y)


n = int(input())
c = list(map(int, input().split()))
s = 0
sc = 0
k = 0
for i in range(len(c)):
	s = s + max(c)
	c.remove(max(c))
	sc = 0
	for item in c:
		sc = sc + item
	if sc < s:
		k = i
		break
print(k + 1)


n = int(input())
ns = input()
ns = ns.split()
nss = []
for i in ns:
	nss.append(int(i))
ns = nss
new = []
num_e = 0
for i in range(n):
	new.append(max(ns))
	ns.remove(max(ns))
	num_e += 1
	if sum(new) <= sum(ns):
		continue
	else:
		break
print(num_e)


import sys
if False:
	input = open('twins.txt', 'r')
else:
	input = sys.stdin
n = int(input.readline().strip())
coins = input.readline().split()
totalSum = 0
required = 0
counter = 0
for c in range(n):
	coins[c] = int(coins[c])
	totalSum = totalSum + coins[c]
half = totalSum / 2
coins.sort()
coins = coins[::-1]
for i in range(n):
	if required > half:
		break
	else:
		counter = counter + 1
		required = required + coins[i]
print(counter)


(n, coins) = (int(input().strip()), list(map(int, input().split())))
coins.sort()
(sum, mysum, c) = (0, 0, -1)
for i in coins:
	sum += i
while mysum <= sum - mysum:
	mysum += coins[c]
	c -= 1
print((c + 1) * -1)


n = int(input())
l = [int(x) for x in input().split()]
a = sorted(l, reverse=True)
s0 = sum(a)
b = []
for i in range(n):
	b.append(a[i])
	s = sum(b)
	if s <= s0 / 2:
		i += 1
	else:
		break
print(i + 1)


x = int(input())
s = input().split()
arr = []
for i in s:
	arr.append(int(i))
arr.sort(reverse=True)
c = sum = 0
for i in range(x):
	c += arr[i]
	for j in range(i + 1, x, 1):
		sum += arr[j]
	if c > sum:
		print(i + 1)
		break
	sum = 0


import sys
input = sys.stdin.readline

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

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

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

def invr():
	return map(int, input().split())
n = inp()
s = inlt()
s = sorted(s, reverse=True)
t = sum(s)
g = 0
o = 0
for i in s:
	g += i
	o += 1
	if g > t - g:
		break
print(o)


n = int(input())
li = list(map(int, input().split()))
li.sort(reverse=True)
s = sum(li)
coin_count = 0
coin = 0
for i in li:
	coin += i
	coin_count += 1
	if coin > s - coin:
		break
print(coin_count)


n = int(input())
a = list(map(int, input().rstrip().split()))
a.sort(reverse=True)
b = []
for _ in range(len(a)):
	b.append(a[_])
	if sum(b) > sum(a) - sum(b):
		break
print(len(b))


n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
sum1 = sum(a)
test = sum1 / 2
final = 0
for i in range(len(a)):
	final = final + a[i]
	if final > test:
		print(i + 1)
		break


n = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
coins = 0
total = 0
for i in a:
	total += i
	coins += 1
	if total > sum(a) - total:
		break
print(coins)


n = int(input().strip())
l = [int(x) for x in input().split(' ')]
v = sum(l) / 2
l = sorted(l, reverse=True)
m = 0.0
i = 0
while m <= v:
	m += l[i]
	i += 1
print(i)


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


n = int(input())
sume = 0
count = 0
t = 0
a = []
a = list(map(int, input().strip().split()))
sume = sum(a)
a.sort(reverse=True)
for i in range(n):
	t += a[i]
	count += 1
	if t > sume / 2:
		print(count)
		break


n = int(input())
Line = [i for i in map(int, input().split())]
k = sum(Line)
Line.sort(reverse=True)
for i in range(n):
	p = 0
	for j in range(i + 1):
		p = p + Line[j]
	if p > k / 2:
		print(i + 1)
		break


n = int(input())
moneys = sorted(list(map(lambda x: int(x), input().split())), key=lambda x: -x)
my_money = 0
k = 0
while my_money <= sum(moneys):
	my_money += moneys[0]
	del moneys[0]
	if len(moneys) == 0:
		moneys.append(0)
	k += 1
print(k)


def qsort(arr):
	less = []
	equal = []
	high = []
	if len(arr) > 1:
		p = arr[-1]
		for x in arr:
			if x < p:
				less.append(x)
			elif x is p:
				equal.append(x)
			else:
				high.append(x)
		return qsort(high) + equal + qsort(less)
	else:
		return arr
s = int(input())
r = [int(x) for x in input().split()]
r = qsort(r)
li = r
ri = [r[0]]
for j in range(1, len(r) + 1):
	if len(ri) > 0:
		rs = sum(ri)
		ls = sum(li)
		if rs > ls:
			print(len(ri))
			exit()
		else:
			ri = r[0:j]
			li = r[j:]
print(len(r))


n = int(input())
coins = map(int, input().split())
coins = list(coins)
coins.sort(reverse=True)
half = sum(coins) / 2
s = 0
for i in range(n):
	s += coins[i]
	if s > half:
		break
print(i + 1)


q = input()
a = list(map(int, input().split()))
a.sort()
(b, c) = (0, 0)
while b <= sum(a):
	b += a.pop()
	c += 1
print(c)


n = input()
coins = [int(x) for x in input().split()]
s = sum(coins)
cs = 0
for (j, i) in enumerate(sorted(coins, reverse=True)):
	cs += i
	if cs > s / 2:
		break
print(j + 1)


i = input()
temp = input().split()
l = []
for var in temp:
	l.append(int(var))
l.sort(reverse=True)
if len(l) == 1:
	n = 1
else:
	n = 0
for var in range(len(l)):
	if sum(l[:var]) > sum(l[var:]):
		n = var
		break
	elif sum(l[:var]) == sum(l[var:]):
		n = var + 1
		break
print(n)


n = int(input())
values = list(map(int, input().split()))
values.sort(reverse=True)
total = sum(values)
counter = 0
amount = 0
i = 0
while amount <= total / 2 and i < len(values):
	counter += 1
	amount += values[i]
	i += 1
print(counter)


n = int(input())
s = [int(x) for x in input().split(' ')]
s.sort(reverse=True)
(num, sub, total) = (0, 0, sum(s))
for i in s:
	if sub <= total - sub:
		sub += i
		num += 1
	else:
		break
print(num)


n = int(input())
a = [int(i) for i in input().split()]
s = 0
tot = 0
c = 0
for i in range(len(a)):
	s += a[i]
for i in range(len(a)):
	for j in range(i + 1, len(a)):
		if a[i] <= a[j]:
			(a[i], a[j]) = (a[j], a[i])
for i in range(len(a)):
	if tot <= s:
		tot += a[i]
		c += 1
		s -= a[i]
	else:
		break
print(c)


def test21():
	cnt = input().strip()
	coins = sorted(list(map(int, input().strip().split(' '))), reverse=True)
	for x in range(len(coins)):
		if sum(coins[:x]) > sum(coins) / 2:
			print(x)
			return
	print(len(coins))
test21()


a = input()
b = [int(x) for x in input().split()]
b.sort()
b.reverse()
c = 0
d = 0
for i in b:
	c += i
t = True
m = 0
while t:
	d += int(b[m])
	m += 1
	if d * 2 > c:
		t = False
print(m)


n = int(input())
s = [int(x) for x in input().split()]
t = 0
for i in range(n):
	t += s[i]
p = sorted(s)
q = 0
r = 0
for m in range(n):
	if 2 * q <= t:
		q += p[-m - 1]
		r += 1
print(r)


n = int(input())
b = []
k = 0
a = list(map(int, input().split()))
(sum_2, sum_1) = (0, 0)
for i in range(len(a)):
	sum_1 = sum_1 + a[i]
a.sort(reverse=True)
for i in range(len(a)):
	if sum_2 <= sum_1:
		b.append(a[i])
		sum_2 = sum_2 + b[i]
		sum_1 = sum_1 - a[i]
		k += 1
print(k)


n = int(input())
l = list(map(int, input().split()))
total = sum(l)
l.sort(reverse=True)
pre = 0
for i in range(n):
	pre = pre + l[i]
	t = total - pre
	if pre > t:
		print(i + 1)
		break


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
for i in range(n):
	if i == len(coins):
		print(len(coins))
		break
	elif sum(coins[:i + 1]) > sum(coins[i + 1:]):
		print(i + 1)
		break
	else:
		continue


noOfCoins = int(input())
a = input().split(' ')
li = []
sum = 0
s = 0
for i in range(0, len(a)):
	li.append(int(a[i]))
li.sort()
for k in range(0, noOfCoins):
	sum += li[k]
j = noOfCoins - 1
if noOfCoins == 2:
	if li[0] == li[1]:
		print('2')
	else:
		print('1')
else:
	while j >= 0:
		s += li[j]
		if s > sum / 2:
			print(noOfCoins - j)
			break
		j -= 1


p = int(input())
k = input()
k = k.split()
for x in range(p):
	k[x] = int(k[x])
k.sort(reverse=True)
s = int(sum(k) / 2)
t = 0

def ff():
	t = 0
	pp = 0
	for x in range(p):
		t += k[x]
		pp += 1
		if t > s:
			return pp
print(ff())


n = int(input())
l = sorted([int(i) for i in input().split()], reverse=True)
s = sum(l)
s1 = 0
c = 0
for i in range(n):
	if s1 > s / 2:
		break
	else:
		s1 += l[i]
		c += 1
print(c)


import sys
import math
import re
import io

def solve(my_list):
	total = 0
	cnt = 0
	val = 0
	for a in my_list:
		total = total + a
	for a in my_list:
		val = val + a
		cnt = cnt + 1
		if val * 2 > total:
			return cnt
	return -1

def main():
	int(input())
	my_list = sorted(map(int, input().split()), reverse=True)
	ans = solve(my_list)
	print(ans)
main()


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
pick = []
for i in range(len(coins)):
	pick.append(coins[i])
	if sum(pick) > sum(coins[i + 1:]):
		break
print(len(pick))


n = int(input())
s = input().split(' ')
s = list(map(int, s))
s.sort(reverse=True)
x = s[0]
i = 1
while x <= sum(s) / 2:
	x += s[i]
	i += 1
print(i)


prefix = []

def prefixArr(arr, n):
	prefixA = []
	prefixA = [0 for i in range(n)]
	prefixA[0] = arr[0]
	for j in range(1, n):
		temp = j - 1
		prefixA[j] = prefixA[temp] + arr[j]
	return prefixA
coin = 0
summ = 0
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
prefix = prefixArr(arr, n)
indexp = n - 2
index = n - 1
while index >= 0:
	summ += arr[index]
	if prefix[indexp] >= summ:
		coin += 1
		index -= 1
		if indexp != 0:
			indexp -= 1
	else:
		coin += 1
		break
print(coin)


def _sumL(l):
	r = 0
	for i in l:
		r = r + i
	return r
n = int(input())
l = []
for i in input().split():
	l.append(int(i))
l.sort(reverse=True)
if len(l) == 1:
	print(1)
else:
	for k in range(0, len(l) + 1):
		if _sumL(l[0:k]) > _sumL(l[k:]):
			print(k)
			break


def bubblesort(alist):
	for passnum in range(len(alist) - 1, 0, -1):
		for i in range(passnum):
			if alist[i] < alist[i + 1]:
				temp = alist[i]
				alist[i] = alist[i + 1]
				alist[i + 1] = temp
	return alist
sumfirst = 0
sumremain = 0
counter = 0
a = int(input())
b = input().split()
for i in range(len(b)):
	b[i] = int(b[i])
	sumremain = sumremain + b[i]
b = bubblesort(b)
flag = 0
for i in range(len(b)):
	sumremain = sumremain - b[i]
	sumfirst = sumfirst + b[i]
	counter = counter + 1
	if sumfirst > sumremain:
		print(counter)
		break


n = int(input())
coins = list(map(int, input().strip().split()))
sum_all = sum(coins)
coins.sort()
coins.reverse()
cnt = your_sum = 0
for i in coins:
	if your_sum > sum_all / 2:
		break
	your_sum += i
	cnt += 1
print(cnt)


import math
numcns = int(input())
cns = sorted(list(map(int, input().split(' '))))
totlamnt = sum(cns)
takeamnt = 0
takecns = 0
i = -1
if totlamnt % 2 == 0:
	while takeamnt <= math.ceil(totlamnt / 2):
		takeamnt += cns[i]
		takecns += 1
		i -= 1
else:
	while takeamnt < math.ceil(totlamnt / 2):
		takeamnt += cns[i]
		takecns += 1
		i -= 1
print(takecns)


(n, l, sum) = (int(input()), [int(ele) for ele in input().split()], 0)
for e in l:
	sum += e
(l.sort(), l.reverse())
(osum, count) = (0, 0)
for e in l:
	osum += e
	count += 1
	if osum > sum - osum:
		break
print(count)


x = int(input())

def intmaker(arr):
	for i in range(len(arr)):
		arr[i] = int(arr[i])
	return arr
y = intmaker(input().split())
count = 0
for i in range(x):
	count += y[i]
mine = 0
count2 = 1
z = 0
for i in range(x):
	z = max(y)
	mine += z
	count -= z
	if mine > count:
		break
	else:
		count2 += 1
		y.remove(z)
print(count2)


n = int(input())
coins = sorted(list(map(int, input().split())))
s = c = 0
while s <= sum(coins):
	s += coins.pop()
	c += 1
print(c)


def main():
	n = int(input())
	arr = sorted(list(map(int, input().split(' '))))
	ptrA = len(arr) - 1
	ptrB = 0
	arrA = []
	arrB = []
	while ptrA >= ptrB:
		arrA.append(arr[ptrA])
		ptrA -= 1
		while sum(arrB) + arr[ptrB] < sum(arrA) and ptrA >= ptrB:
			arrB.append(arr[ptrB])
			ptrB += 1
	print(len(arrA))
main()


n = int(input())
a = (int(x) for x in input().split())
a = list(a)
a = sorted(a, reverse=True)
count = 0
total = 0
bigger = 0
for i in a:
	total = total + int(i)
for x in a:
	count = count + 1
	bigger = bigger + int(x)
	if bigger > total - bigger:
		break
print(count)


input()
l = sorted(list(map(int, input().split())), reverse=True)
answer = sum(l)
i = 0
mysum = 0
while i < len(l):
	mysum += l[i]
	answer -= l[i]
	if mysum > answer:
		break
	i += 1
print(str(i + 1))


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
s1 = 0
s2 = 0
i = 0
while s1 <= s2:
	s1 = sum(a[:i])
	s2 = sum(a[i:])
	i += 1
print(i - 1)


n = int(input())
lis = list(map(int, input().split(' ')))
lis.sort(reverse=True)
lis.append(0)
y = 1
c = lis[0]
for i in range(1, n + 1):
	if c > sum(lis[i:]):
		print(y)
		break
	else:
		c += lis[i]
	y += 1


n = int(input())
coins = [int(coin) for coin in input().split()]
coins.sort()
total = sum(coins)
coin_count = 0
x = 0
for number in coins[::-1]:
	coin_count += 1
	x += number
	if x > total - x:
		break
print(coin_count)


ONLINE_JUDGE = True
ONLINE_JUDGE = False
if not ONLINE_JUDGE:
	try:
		import sys
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	except BaseException:
		pass
n = int(input())
coins = list(reversed(sorted(map(int, input().split()))))
for i in range(n):
	if sum(coins[0:i + 1]) > sum(coins[i + 1:n]) or i == n - 1:
		print(i + 1)
		break


n = int(input())
values = list(map(int, input().split()))
values.sort(reverse=True)
for r in range(1, len(values) + 1):
	better_half = values[:r]
	if sum(better_half) > sum(values) / 2:
		print(len(better_half))
		break


x = int(input())
if x > 1:
	y = sorted(list(map(int, input().split())), reverse=True)
	i = 0
	count = 1
	coin = y[i]
	while coin <= sum(y[i + 1:]):
		count += 1
		i += 1
		coin += y[i]
	print(count)
else:
	print(1)


input()
coins = input().split()
coins = [int(x) for x in coins]
coins.sort()
total = 0
for value in range(0, len(coins)):
	total = total + coins[value]
coins.reverse()
my_portion = 0
for value in range(0, len(coins)):
	my_portion = my_portion + coins[value]
	if my_portion > total // 2:
		print(value + 1)
		break


n = int(input())
value = input().split()
valuesum = 0
num = 0
for i in range(n):
	for j in range(i):
		if int(value[i]) > int(value[j]):
			(value[i], value[j]) = (value[j], value[i])
for i in range(n):
	valuesum = valuesum + int(value[i])
for i in range(n):
	num = num + int(value[i])
	if num > valuesum // 2:
		print(i + 1)
		break


def main():
	input()
	data = list(map(int, input().split()))
	data.sort()
	a = [0] * len(data)
	a[0] = data[0]
	for i in range(1, len(data)):
		a[i] = a[i - 1] + data[i]
		pass
	b = [0] * (len(data) + 1)
	ans = 0
	for i in range(len(data) - 1, 0, -1):
		b[i] = data[i] + b[i + 1]
		if b[i] <= a[i - 1]:
			continue
		else:
			ans = len(data) - i
			break
		pass
	if ans:
		print(ans)
	else:
		print(len(data))
	pass
main()


n = int(input())
coins = sorted(list(map(int, input().split(' '))), reverse=True)
total = sum(coins)
j = 0
current_sum = 0
while j < n:
	current_sum += coins[j]
	if current_sum * 2 > total:
		break
	j += 1
print(j + 1)


n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
desired_sum = sum(a) // 2
coins = []
for i in a:
	coins.append(i)
	if sum(coins) > desired_sum:
		break
print(len(coins))


n = int(input())
if n == 1:
	print(1)
else:
	l = list(map(int, input().split()))
	l.sort()
	s = [0] * n
	h = [0] * n
	s[0] = l[0]
	h[n - 1] = l[n - 1]
	for i in range(n - 2, -1, -1):
		h[i] = l[i] + h[i + 1]
	for i in range(1, n):
		s[i] = s[i - 1] + l[i]
	s.insert(0, 0)
	ind = 0
	ct = 0
	for i in range(n - 1, -1, -1):
		ct += 1
		if h[i] > s[i]:
			fg = 1
			break
	print(ct)


n = int(input())
l = list(map(int, input().split()))
l.sort()
sum_l = []
count = 0
for i in range(n):
	sum_l.append(l[i] + count)
	count += l[i]
sum_l = sum_l[::-1]
l = l[::-1]
rip = False
count = 0
plus = 0
for i in range(n - 1):
	if plus + l[i] > sum_l[i + 1]:
		count += 1
		print(count)
		rip = True
		break
	plus += l[i]
	count += 1
if not rip:
	print(n)


n = int(input())
l = list(map(int, input().split()))
l.sort()
l = l[::-1]
s = sum(l)
ss = 0
i = 0
while ss <= s / 2:
	ss += l[i]
	i += 1
print(i)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
oth = sum(a)
cur = 0
for i in range(len(a)):
	cur += a[i]
	oth -= a[i]
	if cur > oth:
		print(i + 1)
		exit(0)


n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
count = 0
total = sum(a)
temp = 0
for i in a:
	temp += i
	count += 1
	if temp > total - temp:
		break
print(count)


n = int(input())
l = [int(i) for i in input().split()]
l.sort(reverse=True)
i = 1
while sum(l[:i]) <= sum(l) / 2:
	i += 1
print(i)


def twins(inp):
	lst = [int(inp) for inp in input().split()]
	if len(lst) > 2:
		lst.sort()
		value = 0
		for i in lst:
			value += i
		if value % 2 == 0:
			res = value // 2
		else:
			res = value // 2 + 1
		summ = 0
		counter = 0
		new_lst = []
		for i in lst[::-1]:
			new_lst.append(i)
		for i in new_lst:
			summ += i
			counter += 1
			if summ > res:
				print(counter)
				break
			else:
				continue
	elif len(lst) == 2:
		if lst[0] > lst[1]:
			print('1')
		else:
			print('2')
	elif len(lst) == 1:
		print('1')
k = int(input())
twins(k)


n1 = int(input())
l = list(map(int, input().split()))
l.sort()
l.reverse()
count = 0
sum1 = 0
for i in range(len(l)):
	count += 1
	sum1 += l[i]
	if sum1 > sum(l) - sum1:
		break
print(count)


t = int(input())
a = input().split(' ')
left = 0
for i in range(t):
	a[i] = int(a[i])
	left += a[i]
a.sort()
j = t - 1
count = 0
value = 0
while j >= 0:
	if value > left:
		break
	value += a[j]
	left -= a[j]
	count += 1
	j -= 1
print(count)


n = input()
s = input()
l = list()
n = s.split()
for i in n:
	if i == ' ':
		continue
	else:
		l.append(int(i))
l.sort(reverse=True)
if len(l) == 1:
	print(1)
else:
	for i in range(len(l) - 1):
		sum1 = 0
		sum2 = 0
		sum1 = sum1 + sum(l[:i + 1])
		sum2 = sum2 + sum(l[i + 1:])
		if sum1 > sum2:
			k = i + 1
			print(k)
			break
		elif sum1 == sum2:
			m = i + 2
			print(m)
			break
		else:
			continue


n = input()
coins = list(map(int, input().split()))
sorted_coins = sorted(coins, reverse=True)
total = sum(coins)
mytotal = 0
mycoins = 0
for i in range(len(sorted_coins)):
	mytotal += sorted_coins[i]
	mycoins += 1
	if mytotal > total - mytotal:
		break
print(mycoins)


input()
m = list(sorted(map(int, input().split())))
s = sum(m) / 2
i = 0
my = 0
while True:
	if not m or my > sum(m):
		break
	for item in m:
		if item >= s:
			i += 1
			my += item
			m.remove(item)
			s -= item / 2
			break
	else:
		s -= m[-1] / 2
		my += m.pop()
		i += 1
print(i)


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


a = input()
a = sorted(list(map(int, input().split(' '))))[::-1]
a_s = sum(a)
ps = 0
for i in range(len(a)):
	ps += a[i]
	if ps > a_s - ps:
		print(i + 1)
		break


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


number_coins = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
avg = sum(a) / 2
count = 1
if avg > a[0]:
	i = 1
	count = 1
	sumo = a[0]
	while sumo <= avg and i < len(a):
		sumo = sumo + a[i]
		count = count + 1
		i = i + 1
elif avg == a[0]:
	print(2)
else:
	print(1)
if count > 1:
	print(count)


n = int(input())
value = [int(i) for i in input().split()]
target = sum(value) / 2
value = sorted(value)
value = value[::-1]
cnt = 0
for i in range(n):
	cnt += value[i]
	if cnt > target:
		break
print(i + 1)


n = int(input())
l = sorted(list(map(int, input().split())), reverse=True)
s = sum(l)
c = 0
(c1, c2) = (0, s)
while c1 <= c2:
	c1 += l[c]
	c2 -= l[c]
	c += 1
print(c)


coinnumber = int(input())
coins = input().split()
k = 0
while k < len(coins):
	coins[k] = int(coins[k])
	k = k + 1
coins.sort(reverse=True)
i = 0
j = 0
money = 0
mymoney = 0
while i < coinnumber:
	a_coin = int(coins[i])
	money = money + a_coin
	i = i + 1
while j < coinnumber:
	a_coin = int(coins[j])
	mymoney = mymoney + a_coin
	if mymoney > money / 2:
		print(j + 1)
		break
	else:
		j = j + 1


n = int(input())
l = list(map(int, input().split()))
l.sort()
l.reverse()
x = sum(l)
count = 0
p = 0
for i in range(len(l)):
	p += l[i]
	count += 1
	if p > x - p:
		print(count)
		break


n = int(input())
h = sorted(list(map(int, input().split())), reverse=True)
j = sum(h)
p = 0
k = 0
for i in range(n):
	p += 1
	k += h[i]
	j -= h[i]
	if k > j:
		print(p)
		break


n = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
sumRem = sum(arr)
sum1 = 0
ans = 0
for x in arr:
	ans += 1
	sum1 += x
	sumRem -= x
	if sum1 > sumRem:
		break
print(ans)


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


a = int(input())
b = sorted(list(map(int, input().split())))
c = b[::-1]
d = sum(b) // 2
e = 0
f = 0
for i in c:
	e += i
	f += 1
	if e > d:
		break
print(f)


n = int(input())
l = input().split()
l = list(map(int, l))
s1 = sum(l) / 2
l.sort(reverse=True)
q = 0
for i in range(len(l)):
	q = q + l[i]
	if q > s1:
		print(i + 1)
		break


lisa = input()
lisa = int(lisa)
jin = input()
index = [0] * lisa
count = -1
for i in range(len(jin)):
	if jin[i] == ' ':
		count += 1
		index[count] = i
kate = [0] * lisa
if index[0] == 1 or lisa == 1:
	kate[0] = int(jin[0])
else:
	kate[0] = int(jin[0:index[0]])
for i in range(count):
	kate[i + 1] = int(jin[index[i] + 1:index[i + 1]])
if lisa != 1:
	kate[count + 1] = int(jin[index[count] + 1:])
else:
	pass
kate = sorted(kate, key=int, reverse=True)
coins = 0
value = 0
for i in range(len(kate) - 1):
	if float(value) < sum(kate) / 2:
		value += kate[i]
		coins += 1
	else:
		break
if float(value) <= sum(kate) / 2:
	coins += 1
else:
	pass
print(coins)


import sys
import os
if os.environ.get('DEBUGSTER_PYTHON'):
	sys.stdin = open('in.txt', 'r')
	sys.stdout = open('out.txt', 'w')
n = int(input())
d = list(map(int, input().split()))
d.sort()
f_sum = [0]
for i in range(0, n):
	f_sum.append(f_sum[i] + d[i])
ans = 0
total = 0
for i in range(n, 0, -1):
	total += d[i - 1]
	ans += 1
	if total > f_sum[i - 1]:
		break
print(ans)


n_coin = int(input())
x = [int(x) for x in input().strip().split(' ')]
x.sort(reverse=True)
sum_arr = sum(x)
my_sum = 0
for i in range(len(x)):
	my_sum = my_sum + x[i]
	sum_arr = sum_arr - x[i]
	if my_sum > sum_arr:
		print(i + 1)
		break


n = int(input())
one = [int(i) for i in input().split()]
one.sort(reverse=True)
(total, count, i) = (0, 0, 0)
k = sum(one)
x2 = k // 2
x1 = k - x2
x = len(one)
while x:
	if total > x2:
		break
	else:
		total += one[i]
		count += 1
	x -= 1
	i += 1
print(count)


n = int(input())
a = [int(elem) for elem in input().split(' ')]
half = sum(a) // 2
(c, q) = (0, 0)
for (i, v) in enumerate(reversed(sorted(a))):
	q += v
	c += 1
	if q > half:
		break
print(c)


n = int(input())
a = input().split()
b = []
my = 0
count = 1
x = 0
for i in range(n):
	b.append(int(a[i]))
b = sorted(b, reverse=True)
if n == 1:
	print(count)
else:
	for i in range(n):
		my += int(b[i])
		if my <= sum(b[-1:-(len(b) - x):-1]):
			count += 1
			x += 1
	print(count)


def twinCoins():
	N = int(input())
	X = [int(i) for i in input().split()]
	X.sort(reverse=True)
	m = sum(X)
	l = 0
	cnt = 0
	for i in X:
		l += i
		m -= i
		cnt += 1
		if l > m:
			return cnt
print(twinCoins())


z = input()
c = sorted(map(int, input().split()))
a = b = 0
while a <= sum(c) / 2:
	a += c[~b]
	b += 1
print(b)


n = int(input())
s = input().split()
a = [int(i) for i in s]
l = len(a)
p = sum(a) // 2
m = max(a)
del a[a.index(m)]
k = 1
if m == 0:
	print(0)
elif l == 1 or m > p:
	print(k)
elif m == p:
	print(k + 1)
elif l > 1:
	while m <= p:
		m += max(a)
		k += 1
		del a[a.index(max(a))]
	print(k)


num_1 = int(input())
coins = list((int(x) for x in input().split()))
coins.sort(reverse=True)
for i in range(num_1):
	mine = coins[:i + 1]
	ano = coins[i + 1:]
	a = sum(mine)
	b = sum(ano)
	if a > b:
		break
print(len(mine))


n = int(input())
arr = sorted(map(int, input().split()), reverse=True)
k = sum(arr)
s = k // 2
cur = 0
i = 0
for e in arr:
	cur += e
	i += 1
	if cur > s:
		print(i)
		break


i = input().split()
i1 = input().split()
sum1 = 0
p = 0
sum2 = 0
while p < len(i1):
	i1[p] = int(i1[p])
	p = p + 1
p = 0
i1 = sorted(i1)
while p < len(i1):
	sum1 = sum1 + i1[p]
	p = p + 1
u = len(i1) - 1
p = 0
while sum2 <= sum1:
	sum2 = sum2 + i1[u]
	sum1 = sum1 - i1[u]
	u = u - 1
	p = p + 1
print(p)


numb = input()
coins = [int(a) for a in input().split()]
coins.sort(reverse=True)
for x in range(len(coins) - 1):
	if sum(coins[:x + 1]) > sum(coins[x + 1:]):
		print(len(coins[:x + 1]))
		break
else:
	print(len(coins))


n = int(input())
b = [int(i) for i in input().split()]
a = []
d = 0
for i in range(len(b)):
	a.append(b[i])
	d = d + int(b[i])
a.sort()
c = 0
e = 0
for x in range(n - 1, -1, -1):
	c = c + int(a[x])
	e = e + 1
	if 2 * c > d:
		break
print(e)


l = int(input())
a = list(map(int, input().split()))
a.sort(key=int)
dropList = []
if sum(a) / l == a[0]:
	print(l // 2 + 1)
else:
	for i in a:
		dropList.append(a.pop())
		if sum(dropList) > sum(a):
			break
	print(len(dropList))


n = int(input())
inp = input().split(' ')
inp = [int(i) for i in inp]
inp.sort(reverse=True)
sum = 0
for i in inp:
	sum += i
(check, i) = (0, 0)
while check < sum // 2 + 1:
	check += inp[i]
	i += 1
print(i)


n = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
total = sum(arr)
x = 0
for i in range(len(arr)):
	x += arr[i]
	if x > total / 2:
		print(i + 1)
		break


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
i = 1
while True:
	temp = sum(l[:i])
	if temp > sum(l[i:]):
		print(i)
		break
	else:
		i += 1


n = int(input())
coin = [int(x) for x in input().split()]
coin = sorted(coin, reverse=True)
half = sum(coin) // 2 + 1
coins = 0
ans = 0
for i in range(len(coin)):
	ans += 1
	coins += coin[i]
	if coins >= half:
		break
print(ans)


input()
a = [int(s) for s in input().split()]
a.sort()
a.reverse()
c = 0
k = 0
s = sum(a)
for i in a:
	c += 1
	k += i
	if s - k < k:
		break
print(c)


input()
b2 = [int(x) for x in input().split()]
b2.sort(reverse=True)
b1 = []
while sum(b2) >= sum(b1):
	b1.append(b2.pop(0))
print(len(b1))


n = int(input())
num1 = list(map(int, input().split()))
num2 = sorted(num1, reverse=True)
a = 0
for i in range(n):
	if sum(num2[:i + 1]) > sum(num2[i + 1:]):
		a = i + 1
		break
	else:
		continue
print(a)


input()
coins = sorted([*map(int, input().split())], reverse=True)
me = 1
while sum(coins[:me]) <= sum(coins[me:]):
	me += 1
print(me)


n = int(input())
coins_raw = list(map(int, input().split(' ')))
target = sum(coins_raw) / 2
count = 0
current = 0
coins = {}
end = False
for c in coins_raw:
	if c in coins:
		coins[c] += 1
	else:
		coins[c] = 1
for c in sorted(list(coins.keys()), reverse=True):
	if end:
		break
	while coins[c] > 0 and (not end):
		count += 1
		current += c
		coins[c] -= 1
		if current > target:
			print(count)
			end = True


n = int(input(''))
weight_string = input('')
weight = [0 for x in range(n)]
value = 0
index = 0
for char in weight_string:
	if char == ' ':
		weight[index] = value
		value = 0
		index = index + 1
	else:
		value = 10 * value + int(char)
weight[index] = value
weight.sort()
half = sum(weight) / 2
sum = 0
i = 0
while sum <= half:
	sum = sum + weight[n - 1 - i]
	i = i + 1
print(i)


def tugra_sort(list):
	a = 1
	while a != 0:
		a = 0
		for i in range(0, len(list) - 1):
			if list[i] < list[i + 1]:
				x = list[i]
				y = list[i + 1]
				list[i] = y
				list[i + 1] = x
				a = a + 1
	return list

def summing(list):
	total = 0
	for item in list:
		total = total + item
	return total
n = int(input())
list1 = list(map(int, input().split()))
list1 = tugra_sort(list1)
sum = summing(list1)
total = 0
for i in range(len(list1)):
	total = total + list1[i]
	if total > sum / 2:
		print(i + 1)
		break


n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
a_sum = sum(a)
your_mon = 0
for i in range(n):
	your_mon += a[i]
	if your_mon > a_sum // 2:
		print(i + 1)
		exit(0)


n = int(input())
coins = [int(num) for num in input().split(' ')]
coins.sort(reverse=True)
add = 0
k = 0
for i in coins:
	add += i
	k += 1
	if add > sum(coins) - add:
		break
print(k)


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


n = int(input())
c = [int(x) for x in input().split()]
c.sort()
c.reverse()
s = u = N = 0
for i in c:
	s += i
for i in range(n):
	if u <= s / 2:
		u += c[i]
		N += 1
print(N)


n = int(input())
val = list(map(int, input().split()))
val.sort(reverse=True)
tval = sum(val)
n1 = 0
val1 = 0
for i in range(0, n):
	if val1 <= tval / 2:
		val1 += val[i]
		n1 += 1
print(n1)


n = input()
coins = input()
allCoins = coins.split(' ')
for i in range(len(allCoins)):
	allCoins[i] = int(allCoins[i])
globalSum = sum(allCoins)
allCoins.sort(reverse=True)
mySum = 0
myCoins = 0
for x in allCoins:
	mySum += x
	myCoins += 1
	globalSum -= x
	if mySum > globalSum:
		break
print(myCoins)


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


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
b = []
for i in range(n):
	b.append(a[i])
	if sum(b) > sum(a[i + 1:n]) or b[0] > sum(a[i:n]):
		break
print(len(b))


t = int(input())
lst = list(map(int, input().split()))
sum1 = sum(lst) // 2
lst.sort()
lst = lst[::-1]
sum2 = 0
c = 0
for i in range(t):
	sum2 = sum2 + lst[i]
	c += 1
	if sum2 > sum1:
		break
print(c)


n = int(input())
k = list(map(int, input().strip().split()))
k.sort(reverse=True)
mindiff = k[0]
pick = 0
for i in range(len(k)):
	sum1 = sum(k[:i + 1])
	sum2 = sum(k[i + 1:])
	if sum1 > sum2:
		pick = len(k[:i + 1])
		break
print(pick)


from sys import stdin
input = stdin.readline

def coins(n):
	c = list(map(int, input().split()))
	c.sort(reverse=True)
	(a, b) = (0, sum(c))
	for i in range(len(c)):
		a += c[i]
		b -= c[i]
		if b < a:
			break
	return i + 1
print(coins(int(input())))


x = int(input())
y = input()
y = y.split()
coins = [int(i) for i in y]
coins.sort(reverse=True)
sumC = sum(coins)
my = 0
i = 0
while True:
	my += coins[i]
	i += 1
	if my > sumC - my:
		break
print(i)


n = int(input())
val = [int(i) for i in input().split()]
val.sort(reverse=True)
halfsum = sum([i for i in val]) / 2
pick = 0
steal = 0
for i in range(n):
	if steal > halfsum:
		break
	steal = steal + val[i]
	pick += 1
print(pick)


n = int(input())
values = [int(value) for value in input().split()]
half = sum(values) / 2
coins = 0
qtd = 0
values.sort()
for i in range(len(values) - 1, -1, -1):
	qtd += values[i]
	coins += 1
	if qtd > half:
		break
print(coins)


n = int(input())
data = input()
lst = list()
for i in data.split():
	lst.append(int(i))
lst.sort(reverse=True)
total = 0
for k in lst:
	total = total + k
count = 0
tsum = 0
for j in lst:
	count = count + 1
	tsum = tsum + j
	if tsum > total / 2:
		break
print(count)


n = int(input())
val = list(map(int, input().split()))
s = sum(val)
val.sort(reverse=True)
count = 0
j = 0
sc = 0
for i in val:
	if sc > s / 2:
		break
	else:
		sc += val[j]
		j += 1
		count += 1
print(count)


c = int(input())
l = sorted(map(int, input().split()), reverse=True)
x = sum((j for j in l))
n = 0
for i in range(len(l)):
	n += l[i]
	if n > x / 2:
		print(i + 1)
		break


n = int(input())
coins = [int(x) for x in input().split()]
coins.sort()
sum = 0
for c in coins:
	sum += c
half = sum // 2
cnt = -1
sum = 0
while sum <= half:
	sum += coins[cnt]
	cnt -= 1
print(-(cnt + 1))


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


n = int(input())
f = list(map(int, input().split()))
f.sort(reverse=True)
s = sum(f) / 2
scount = 0
count = 0
for i in f:
	if scount <= s:
		scount += i
		count += 1
	else:
		break
print(count)


num = int(input())
coin = input()
pieces = coin.split()
value = 0
list = []
twin = 0
q = 0
for i in range(0, len(pieces)):
	value += int(pieces[i])
	list.append(int(pieces[i]))
list.sort()
list.reverse()
for i in range(num):
	if twin <= value / 2:
		twin += list[q]
		q += 1
	else:
		break
print(q)


from itertools import combinations
n = int(input())
a = list(map(int, input().split()))
arr = []
b = sum(a)
sum1 = 0
a.sort(reverse=True)
count = 1
for i in a:
	b = b - i
	sum1 = sum1 + i
	if b >= sum1:
		count += 1
	else:
		break
print(count)


import random
import re
n = int(input())
s = input()
nums = [int(i) for i in re.findall('\\d+', s)]
number = nums[:n]
number.sort(reverse=True)
sumnum = sum(number)
sumnow = 0
cnt = 0
for i in number:
	if sumnow * 2 > sumnum:
		break
	else:
		sumnow = sumnow + i
	cnt = cnt + 1
print(cnt)


def Solution(Coins):
	Group1 = 0
	Group2 = 0
	Result_Group = 0
	Coins = sorted(Coins)
	for i in Coins:
		Group1 += i
	for i in Coins[::-1]:
		Group2 += i
		Result_Group += 1
		if Group2 > Group1 / 2:
			break
	return Result_Group
Coins = input()
Coins_Price = list(map(int, input().split()))
print(Solution(Coins_Price))


n = int(input())
coins = list(map(int, input().split()))
rem_coins_sum = sum(coins)
coins.sort(reverse=True)
coins_taken_sum = 0
coins_taken_count = 0
for coin in coins:
	coins_taken_sum += coin
	rem_coins_sum -= coin
	coins_taken_count += 1
	if coins_taken_sum > rem_coins_sum:
		break
print(coins_taken_count)


x = int(input())
b = list(map(int, input().split()))
b.sort()
i = 0
r = sum(b[x - i:0])
s = sum(b[0:x - i])
while s >= r:
	i += 1
	r = sum(b[x - i:])
	s = sum(b[0:x - i])
print(i)


input()
c = sorted(map(int, input().split()))
m = sum(c) / 2
a = b = 0
i = 1
while a <= m:
	a += c[-i]
	i += 1
	b += 1
print(b)


n = int(input())
L = list(map(int, input().split()))
L.sort()
s = sum(L) // 2
r = 1
t = L[n - 1]
while t <= s:
	r += 1
	t += L[n - r]
print(r)


n = int(input())
a = input()
tmp = []
avg = 0
a = a.split()
for i in range(n):
	tmp.append(int(a[i]))
	avg += int(a[i])
avg = avg / 2
total = 0
tmp.sort(reverse=True)
for i in range(len(tmp)):
	total += tmp[i]
	if total > avg:
		print(i + 1)
		break


n = int(input())
a = [int(x) for x in input().split()]
sum = 0
a.sort()
for i in range(n):
	sum = sum + a[i]
b = 0
c = 0
for i in range(n):
	c += 1
	sum = sum - a[n - 1 - i]
	b = b + a[n - 1 - i]
	if sum >= b:
		continue
	else:
		break
print(c)


n = int(input())
s = [int(x) for x in input().split()]
s.sort()
s = s[::-1]
x = 0
k = sum(s)
for i in range(n):
	x += s[i]
	if 2 * x > k:
		print(i + 1)
		break


n = int(input())
a = input().split()
total = 0
half = 0
my = 0
count = 0
for i in range(len(a)):
	a[i] = int(a[i])
a.sort(reverse=True)
for i in range(len(a)):
	total += a[i]
half = total / 2
for i in range(len(a)):
	if half >= my:
		my = my + a[i]
		count += 1
	else:
		break
print(count)


input()
a = sorted([int(x) for x in input().split()], reverse=True)
i = 1
while sum(a[:i]) <= sum(a[i:]):
	i += 1
print(i)


length = int(input())
coin = [int(x) for x in input().split()]
b = sorted(coin, reverse=True)
sum = 0
for x in coin:
	sum += x
crit = sum / 2
take = 0
for i in range(length):
	take += b[i]
	if take > crit:
		print(i + 1)
		break


n = int(input())
ls = list(map(int, input().split()))
ls.sort()
ls.reverse()
(sum, taken) = (0, 0)
t = 0
for i in range(n):
	sum += ls[i]
for i in range(n):
	taken += ls[i]
	sum -= ls[i]
	t += 1
	if taken > sum:
		print(t)
		break


n = int(input())
arr = [int(i) for i in input().split()]
arr.sort()
sum = 0
for i in range(n - 1, -1, -1):
	sum += arr[i]
val = 0
numCoins = 0
for i in range(n - 1, -1, -1):
	if val > sum - val:
		print(numCoins)
		exit()
	else:
		val += arr[i]
		numCoins += 1
print(numCoins)


n = int(input())
l = list(map(int, input().split(' ')[:n]))
l = sorted(l)
l = l[::-1]
c = 0
for i in range(n):
	s1 = sum(l[:i + 1])
	s2 = sum(l[i + 1:])
	if s1 > s2:
		print(i + 1)
		break


cant = input()
monedas = input()
L = []
num = ''
for numero in monedas:
	if numero != ' ':
		num = num + numero
	else:
		L.append(int(num))
		num = ''
L.append(int(num))
L.sort()
L.reverse()
(m, suma1, suma2) = (0, 0, 0)
while suma1 <= suma2:
	n = m
	m += 1
	(suma1, suma2) = (0, 0)
	for i in range(int(cant)):
		if m > 0:
			suma1 = suma1 + L[i]
		else:
			suma2 = suma2 + L[i]
		m -= 1
	m = n + 1
print(m)


n = int(input())
line = input()
a = [int(i) for i in line.split()]
b = sorted(a, reverse=True)
soma = 0
ans = 0
soma2 = 0
for j in range(len(a)):
	soma = soma + a[j]
for j in range(len(b)):
	soma2 = soma2 + b[j]
	if soma2 > soma - soma2:
		ans = j + 1
		break
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
s = sum(a)
b = 0
c = 0
for i in range(n):
	if b > s - b:
		break
	else:
		b = b + a[i]
		c = c + 1
print(c)


n = int(input())
list_of_coins = list(map(int, input().split(' ')))
list_of_coins.sort(reverse=True)
sum_of_coins = sum(list_of_coins)
count = 0
sum_of_elder_brother = 0
i = 0
while sum_of_elder_brother <= sum_of_coins / 2:
	sum_of_elder_brother += list_of_coins[i]
	i += 1
	count += 1
print(count)


n = int(input())
v = [int(x) for x in input().split()]
v.sort(reverse=True)
a = sum(v) / 2
m = 0
for i in range(n):
	m += v[i]
	if m > a:
		print(i + 1)
		break


n = int(input())
l = list(map(int, input().split()))
s = sum(l)
l.sort()
ans = 0
c = 0
for i in range(len(l) - 1, -1, -1):
	c += 1
	ans += l[i]
	diff = s - ans
	if ans > diff:
		break
print(c)


n = int(input())
arr = list(map(int, input().split()))
s = sum(arr)
arr.sort(reverse=True)
i = 0
c = 0
for i in range(n):
	c = c + arr[i]
	if c > s / 2:
		break
print(i + 1)


n = int(input())
value = [int(i) for i in input().split()]
value.sort()
thres = sum(value) / 2
S = 0
N = 0
for i in range(n):
	S += value[n - i - 1]
	if S > thres:
		N = i + 1
		break
print(N)


n = int(input())
t0 = input().split()
t = []
for i in t0:
	t.append(int(i))
n = sum(t)
total = 0
x = 0
while True:
	biggest = 0
	for i in t:
		if i > biggest:
			biggest = i
	total += biggest
	t.remove(biggest)
	x += 1
	if total * 2 > n:
		break
print(x)


coins = int(input())
values = map(int, input().split())
sort_coins = sorted(values, reverse=True)
sum_coins = sum(sort_coins)
sum_coins = int(sum_coins / 2) + 1
sumi = 0
i = 0
for j in sort_coins:
	sumi = sumi + j
	i = i + 1
	if sumi >= sum_coins:
		break
print(i)


n = int(input())
l1 = sorted(map(int, input().split()), reverse=True)
summ = 0
count = 0
for i in range(n):
	if summ > sum(l1) // 2:
		break
	else:
		summ += l1[i]
		count += 1
print(count)


n = int(input())
a = input().split()
d = list(())
for k in a:
	d.append(int(k))
d.sort()
d.reverse()
b = int(d[0])
c = 0
count = 1
i = 1
j = 1
while i < len(d):
	while j < len(d):
		c += int(d[j])
		j += 1
	if b > c:
		break
	else:
		j = i + 1
		count += 1
		b += d[i]
		c = 0
	i += 1
print(count)


n = int(input())
a = sorted(map(int, input().split()))
my = 0
bro = sum(a)
x = 0
while my <= bro:
	my += a[-1]
	bro -= a[-1]
	a.pop()
	x += 1
print(x)


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

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

def read(func=int):
	return map(func, input().split())
n = int(input())
coins = sorted(list(read()))
for i in range(n - 1, -1, -1):
	if sum(coins[:i]) < sum(coins[i:]):
		print(n - i)
		break


n = int(input())
t = 0
cnt = 0
l = [int(x) for x in input().split()]
s = sorted(l, reverse=True)
rem = sum(s)
for i in s:
	if t <= rem:
		t += i
		rem -= i
		cnt += 1
	else:
		break
print(cnt)


n = int(input())
m = list(sorted(map(int, input().split())))
s = 0
i = 0
while s <= sum(m):
	s += m.pop()
	i += 1
print(i)


n = int(input())
a = [int(j) for j in input().split()]
a.sort(reverse=True)
sone = a[0]
stwo = sum(a[1:])
i = 0
while sone <= stwo:
	i += 1
	sone += a[i]
	stwo -= a[i]
print(i + 1)


n = int(input())
moedas = list(map(int, input().split()))
moedas.sort()
res = []
while sum(res) <= sum(moedas):
	moeda = moedas.pop()
	res.append(moeda)
print(len(res))


_ = input()
str_inp = input()
inp = [int(x) for x in str_inp.split()]
inp.sort(reverse=True)
total = 0
for i in range(len(inp)):
	total += inp[i]
	if total > sum(inp[i + 1:]):
		print(i + 1)
		break


coin = int(input())
value = list(map(int, input().split()))
value = sorted(value, reverse=True)
valueall = sum(value)
myvalue = 0
hisvalue = valueall - myvalue
mycoin = 0
for i in range(coin):
	myvalue += value[i]
	hisvalue = valueall - myvalue
	mycoin += 1
	if myvalue > hisvalue:
		print(mycoin)
		break


input()
value = sorted(map(int, input().split()))
s = coins = 0
while s <= sum(value):
	s += value.pop()
	coins += 1
print(coins)


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

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

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

def lmp():
	return list(mp())

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

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

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

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

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
n = iinp()
arr = lmp()
arr.sort(reverse=True)
i = 0
s = 0
sm = sum(arr)
while i < n and s <= sm // 2:
	s += arr[i]
	i += 1
print(i)


n = int(input())
coins = [int(x) for x in input().split()]
coins_1 = sorted(coins, key=lambda x: x * -1)
a = 0
for j in range(len(coins_1)):
	a += coins_1[j]
b = 0
num = 1
for i in range(len(coins)):
	b += coins_1[i]
	if b <= a - b:
		num += 1
	else:
		print(num)
		break


def main():
	n = int(input())
	a = [int(i) for i in input().split()]
	s = sum(a)
	a.sort(reverse=True)
	ans = 0
	cur = 0
	for x in a:
		cur += x
		ans += 1
		if cur > s // 2:
			break
	print(ans)
main()


n = int(input())
a = map(int, input().split())
b = list(a)
b.sort()
t = 0
s = 0
for i in range(n):
	s += b[i]
for i in range(n):
	t += b[n - 1 - i]
	if t > s / 2:
		print(i + 1)
		break


n_coins = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
sum_coins = sum(coins)
sum_taken = 0
coins_taken = 0
while sum_coins >= sum_taken:
	sum_coins -= coins[coins_taken]
	sum_taken += coins[coins_taken]
	coins_taken += 1
print(coins_taken)


n = int(input())
coins = input().split()
coins = [int(x) for x in coins]
amt = sum(coins)
amt2 = amt // 2 + 1
coins.sort(reverse=True)
count = 0
add = 0
for i in range(n):
	if add < amt2:
		add += coins[i]
		count += 1
	else:
		break
print(count)


no_of_coins = input()
coin_value = input()
lists = coin_value.split()
my_coin = []
bro_coin = []
for i in lists:
	bro_coin.append(int(i))
while sum(bro_coin) >= sum(my_coin):
	maximum = max(bro_coin)
	my_coin.append(maximum)
	bro_coin.remove(maximum)
print(len(my_coin))


x = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
m = sum(a)
for i in range(x):
	if m - sum(a[:i + 1]) < sum(a[:i + 1]):
		exit(print(i + 1))


import functools
n = int(input())
l = list(map(int, input().split()))
s = functools.reduce(lambda x, y: x + y, l)
l.sort()
l.reverse()
m = 0
if s % 2 == 0:
	m += int(s / 2)
else:
	m += int(s / 2)
d = 1
f = l[0]
for i in range(1, n):
	if f > m:
		break
	else:
		d += 1
		f += l[i]
print(d)


n = int(input())
string = input()
arr = [int(x) for x in string.split()]
s = sum(arr)
target = s // 2 + 1
arr = sorted(arr, reverse=True)
c = 0
i = 0
while c < target and i < len(arr):
	c += arr[i]
	i += 1
print(i)


n = int(input())
a = [int(i) for i in input().split()]
b = sorted(a, reverse=True)
value = 0
for i in range(n):
	value = value + b[i]
	if value > sum(b) - value:
		break
print(i + 1)


n = int(input())
li = [int(x) for x in input().split()]
li.sort()
y = sum(li)
req = y // 2
s = 0
i = 0
while s <= req:
	i = i - 1
	s = s + li[i]
print(-i)


n = int(input())
total = 0
lst = sorted(map(int, input().split()))
s = c = 0
while s <= sum(lst):
	s += lst.pop()
	c += 1
print(c)


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


n = int(input())
arr = sorted(list(map(int, input().split())), reverse=True)
tot = sum(arr)
taken = count = 0
for i in arr:
	taken += i
	tot -= i
	count += 1
	if taken > tot:
		break
print(count)


n = int(input())
ar = list(map(int, input().split()))
total = sum(ar)
ar.sort(reverse=True)
count = 0
curr = 0
for i in ar:
	curr += i
	count += 1
	if curr > total - curr:
		break
print(count)


n = int(input())
li = list(map(int, input().split()))
li.sort()
total = sum(li)
(s, t) = (0, 0)
for i in reversed(li):
	t += 1
	s += i
	if s > total / 2:
		print(t)
		break


n = int(input())
a = list(map(int, input().split()))
s = sum(a)
a.sort()
y = 0
k = 0
for i in a[::-1]:
	if y <= s:
		y += i
		k += 1
		s -= i
	else:
		break
print(k)


def mCheckInput(identifier, *args):
	if identifier == 'isstringint':
		if args[0].isdigit() and 1 <= int(args[0]) <= 100:
			return int(args[0])
		else:
			exit(0)
	elif identifier == 'IsArrayOfLengthAndContent':
		sum = 0
		if args[0].__len__() == args[1]:
			for i in range(len(args[0])):
				if 1 <= args[0][i] <= 100:
					sum += args[0][i]
				else:
					exit(0)
			return sum
		else:
			exit(0)
	else:
		exit(0)

def mHandleInputs():
	try:
		x = input()
		coinsCount = mCheckInput('isstringint', x)
		coinsList = list(map(int, input().split()))
		coinsSum = mCheckInput('IsArrayOfLengthAndContent', coinsList, coinsCount)
		return (coinsSum, coinsList)
	except ValueError as e:
		exit(0)

def mDoWork(coinsSum, coinsList):
	target = coinsSum / 2
	list.sort(coinsList, reverse=True)
	minCoinCount = 0
	for i in range(len(coinsList)):
		if target - coinsList[i] < 0:
			minCoinCount += 1
			return minCoinCount
		elif target - coinsList[i] >= 0:
			minCoinCount += 1
			target -= coinsList[i]
			continue

def mFormatResult(result):
	print(result)

def main():
	(coinsSum, coinsList) = mHandleInputs()
	result = mDoWork(coinsSum, coinsList)
	mFormatResult(result)
main()


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
count = 0
sum_h = 0
sum_i = 0
tot = 0
for i in range(0, len(a)):
	tot += a[i]
for i in range(0, len(a)):
	if sum_h <= tot / 2:
		sum_h += a[i]
		count += 1
print(count)


n = input()
a_i = input().split(' ')
a_ii = []
for i in a_i:
	a_ii.append(int(i))
a_ii.sort()
a_ii.reverse()
mine = 0
twins = 0
j = 0
took = 0
while j < len(a_ii):
	twins += int(a_ii[j])
	j += 1
while twins >= mine:
	mine += int(a_ii[0])
	twins -= int(a_ii[0])
	a_ii.pop(0)
	took += 1
print(took)


n = int(input())
L = list(map(int, input().split()))
L.sort()
(s, m) = (0, 0)
for i in range(n):
	s = s + L[i]
i = 0
while m <= s / 2:
	m = m + L[n - i - 1]
	i = i + 1
print(i)


def solve(c):
	cnt = 0
	for i in range(0, n):
		if sum(c[:i]) > sum(c[i:]):
			return cnt
		else:
			cnt += 1
	return cnt
n = int(input())
c = list(map(int, input().split()))
cnt = 0
c.sort(reverse=True)
print(solve(c))


n = int(input())
l = list(map(int, input().split()))
s = sum(l)
x = len(l)
z = 0
for i in range(n):
	y = max(l)
	if z <= s / 2:
		z += y
		l.remove(y)
print(x - len(l))


a = int(input())
monedas = input()
monedas = monedas.split()
monedas = [int(i) for i in monedas]
monedas.sort(reverse=True)
dintot = 0
dintom = 0
nummon = 0
for i in monedas:
	dintot += i
for i in monedas:
	if dintot >= dintom:
		dintom += i
		dintot -= i
		nummon += 1
	else:
		break
print(nummon)


n = int(input())
counter = 0
money_now = 0
money_left = list(map(int, input().split()))
while sum(money_left) >= money_now:
	money_now += max(money_left)
	money_left.pop(money_left.index(max(money_left)))
	counter += 1
print(counter)


n = int(input())
s = sorted([int(x) for x in input().split()])
i = n - 1
while i >= 0:
	if sum(s[i:]) > sum(s[:i]):
		break
	i -= 1
print(n - i)


n = input()
arr = sorted(map(int, input().split()))
a = ans = 0
while a <= sum(arr):
	a += arr.pop()
	ans += 1
print(ans)


m = int(input())
n = list(map(int, input().split()))
n.sort()
n = n[::-1]
for i in range(len(n)):
	s = n[0:i + 1]
	e = n[i + 1:len(n)]
	ss = sum(s)
	es = sum(e)
	if ss > es:
		print(i + 1)
		break


n = int(input())
list = [int(x) for x in input().split()]
list.sort(reverse=True)
total = 0
for x in range(n):
	total += list[x]
myshare = 0
i = 0
while myshare <= total / 2:
	myshare += list[i]
	i += 1
print(i)


n = int(input())
l = list(map(int, input().split(' ')))
l.sort(reverse=True)
for i in range(1, n):
	l[i] = l[i - 1] + l[i]
for i in range(n):
	if l[i] > l[n - 1] - l[i]:
		print(i + 1)
		break


from sys import stdin
num_coins = int(stdin.readline().strip())
coins = stdin.readline().strip().split(' ')
coins = [int(coin) for coin in coins]
coins.sort(reverse=True)
total_coin_val = sum(coins)
val_to_be_gt = total_coin_val // 2
curr_total = 0
output = num_coins
for i in range(num_coins):
	curr_total += coins[i]
	if curr_total > val_to_be_gt:
		output = i + 1
		break
print(output)


input()
A = list(map(int, input().split()))
A.sort()
x = sum(A)
cu = 0
an = 0
while cu <= x // 2:
	cu += A.pop()
	an += 1
print(an)


(s, c) = (0, 0)
n = input()
li = sorted([int(x) for x in input().split()], reverse=True)
total = sum(li)
for i in li:
	s += i
	c += 1
	if s > total - s:
		break
print(c)


n = int(input())
a = sorted((int(i) for i in input().split()))
s = sum(a) / 2
c = 0
ts = 0
for i in range(n - 1, -1, -1):
	c += 1
	ts += a[i]
	if ts > s:
		break
print(c)


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


n = int(input())
ar = list(map(int, input().rstrip().split()))
ar.sort(reverse=True)
summ = sum(ar)
num_c = 0
vall = 0
for i in range(n):
	if vall <= summ / 2:
		num_c += 1
		vall += ar[i]
print(num_c)


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


def thief(coins, ncoins, total, my_money):
	if my_money > total:
		return 0
	if ncoins == -1:
		return 0
	stolen_coins = coins[ncoins]
	return 1 + thief(coins, ncoins - 1, total - stolen_coins, my_money + stolen_coins)
ncoins = int(input())
coins = list(map(int, input().rstrip().split()))
print(thief(sorted(coins), ncoins - 1, sum(coins), 0))


n = input()
l_ = sorted(list(map(int, input().split())))
i = -1
while sum(l_[i:]) <= sum(l_[:i]):
	i -= 1
print(abs(i))


import sys

def calc(count, sum):
	cur = 0
	num = 0
	for i in range(len(count) - 1, 0, -1):
		for j in range(count[i]):
			cur += i
			num += 1
			if cur > sum - cur:
				return num
	return num
n = int(input())
l = list(map(int, sys.stdin.readline().split()))
count = [0] * 101
sum = 0
for i in range(len(l)):
	count[l[i]] += 1
	sum += l[i]
print(calc(count, sum))


n = int(input())
l = list(map(int, input().split()))
(s, count) = (0, 0)
total = 0
for i in l:
	total += i
while s <= total // 2:
	s += max(l)
	count += 1
	l.remove(max(l))
print(count)


n = int(input())
coins = list(map(int, input().split()))
total = sum(coins)
num_coins = 0
sum_coins = 0
for coin in sorted(coins, reverse=True):
	num_coins += 1
	sum_coins += coin
	if sum_coins > total // 2:
		break
print(num_coins)


i = int(input())
y = input().split()
y.sort(key=int, reverse=True)
h = 0
s = 0
count = 0
for p in y:
	s = s + int(p)
for p in y:
	h = h + int(p)
	count = count + 1
	if h > s / 2:
		print(count)
		exit()


def twins(a, n):
	t = len(a)
	for i in range(1, len(a)):
		if sum(a[0:i]) > sum(a[i:]):
			t = i
			break
	return t
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(twins(a, n))


n = int(input())
alist = []
li = list(map(int, input().split()))
li.sort(reverse=True)
for i in range(len(li)):
	alist.append(li[i])
	if sum(alist) > sum(li[i + 1:]):
		break
print(len(alist))


n = int(input())
s = str(input()).split(' ')
a = []
for elem in s:
	a.append(int(elem))
a.sort()
q = sum(a) // 2
k = 0
w = 0
while w <= q:
	w += a[n - 1 - k]
	k += 1
print(k)


x = int(input())
y = input()
y = y.split()
l = []
for i in y:
	i = int(i)
	l.append(i)
l.sort()
l = l[::-1]
c = 1
s1 = l[0]
s = 0
for i in range(len(l)):
	for j in range(i + 1, len(l)):
		s = s + l[j]
	if s1 <= s:
		s1 = s1 + l[i + 1]
		c += 1
	s = 0
print(c)


n = int(input())
a = input().split()
a2 = []
for b in a:
	a2.append(int(b))
d1 = 0
sm = 0
t1 = 0
for s in a2:
	sm += s
while d1 <= sm / 2:
	d1 += max(a2)
	a2.remove(max(a2))
	t1 += 1
print(t1)


from functools import reduce
n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
k = 0
t = 0
for i in range(0, n):
	t += a[i]
q = 0
for i in range(0, n + 1):
	if k > t:
		print(q)
		break
	q += 1
	t -= a[i]
	k += a[i]


n = int(input())
lix = [int(i) for i in input().split()][:n]
lix.sort(reverse=True)
smaller = True
i = 0
sumb1 = 0
coins = 0
while smaller and i < len(lix):
	sumb1 += lix[i]
	coins += 1
	j = i + 1
	sumb2 = 0
	while j < len(lix):
		sumb2 += lix[j]
		j += 1
	if sumb1 > sumb2:
		print(coins)
		smaller = False
	i += 1


from math import *

def main():
	n = int(input())
	a = sorted(list(map(int, input().split())), reverse=True)
	sa = sum(a)
	s = 0
	i = 0
	while not s > sa:
		s += a[i]
		sa -= a[i]
		i += 1
	print(i)
main()


n = int(input())
lst = [int(x) for x in input().split()]
total_money = 0
for x in lst:
	total_money += x
half_money = total_money / 2
lst.sort()
lst.reverse()
(count, my_money) = (0, 0)
for x in lst:
	my_money += x
	count += 1
	if my_money > half_money:
		break
print(count)


n = int(input())
coins = [int(i) for i in input().split()]
coins.sort()
coins = coins[::-1]
found = False
for i in range(n):
	if sum(coins[:i]) > sum(coins[i:]):
		print(i)
		found = True
		break
if not found:
	print(n)


t = int(input())
arr = list(map(int, input().split()))
a = sum(arr)
result = 0
count = 0
arr.sort()
arr.reverse()
while True:
	if a >= result:
		count = count + 1
		b = arr.pop(0)
		result = result + b
		a = a - b
	if a < result:
		print(count)
		break


n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
total = sum(a)
p = 0
for i in range(n):
	p = sum(a[:i + 1])
	if 2 * p > total:
		print(i + 1)
		break


n = int(input())
arr = list(map(int, input().split()))
s = sum(arr)
arr.sort(reverse=True)
(tot, count) = (0, 0)
for i in range(n):
	if tot > s - tot:
		break
	else:
		tot += arr[i]
		count += 1
print(count)


from sys import stdin
n = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
x = sum(a) / 2
a.sort(reverse=True)
y = 0
for i in range(n):
	y += a[i]
	if y > x:
		print(i + 1)
		break


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
sum1 = sum(l)
s = 0
i = n - 1
res = 0
while s <= sum1 - s:
	s += l[i]
	res += 1
	i -= 1
print(res)


a = int(input())
f = list(map(int, input().split()))
f.sort()
f.reverse()
result = 0
sum = 0
stole = 0
for i in range(0, len(f)):
	sum = sum + f[i]
while stole <= sum:
	stole = stole + f[result]
	sum = sum - f[result]
	result = result + 1
print(result)


n = int(input())
data = list(map(int, input().split()))
data.sort(reverse=True)
total = 0
i = 0
cont = 0
t = False
while i < len(data) and t == False:
	if total > sum(data[i:]):
		t = True
	else:
		cont += 1
		total += data[i]
	i += 1
print(cont)


n = int(input())
s = [int(x) for x in input().split()]
s.sort(reverse=True)
for i in range(len(s)):
	if sum(s[:i + 1]) > sum(s[i + 1:]):
		print(i + 1)
		break


n = input('')
sn = input('')
min_cn = 0
accum = 0
sn_list = [int(k) for k in sn.split(' ')]
sn_list.sort(reverse=True)
sn_list_dup = sn_list.copy()
for x in range(len(sn_list)):
	if accum > sum(sn_list_dup):
		break
	accum += sn_list_dup.pop(0)
	min_cn += 1
print(min_cn)


a = int(input())
b = sorted(list(map(int, input().split())))
jam = 0
l = len(b)
s = sum(b) / 2
for i in range(1, l + 1):
	jam += b[l - i]
	if jam > s:
		print(i)
		exit()


n = int(input())
l = [int(x) for x in input().split()]
l = sorted(l, reverse=True)
s = 0
a = 0
t = sum(l) // 2
for i in l:
	s += i
	a += 1
	if s > t:
		print(a)
		break


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
c = 1
s = sum(a)
s = s // 2
sm = a[0]
for i in range(1, len(a)):
	if sm <= s:
		sm = sm + a[i]
		c = c + 1
print(c)


n = input()
coins = input()
l = coins.split(' ')
l2 = []
for a in range(len(l)):
	l2.append(int(l[a]))
new = []
sum1 = sum(l2)
sum2 = 0
while sum1 >= sum2:
	a = max(l2)
	l2.remove(a)
	new.append(a)
	sum1 = sum(l2)
	sum2 = sum(new)
print(len(new))


import sys
n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
for i in range(0, n, 1):
	if sum(l[:i + 1]) > sum(l[i + 1:n]):
		print(i + 1)
		sys.exit(0)
print(n)


n = int(input())
vals = list(map(int, input().split()))
vals.sort()
vals.reverse()
coins_taken = 0
while sum(vals[:coins_taken + 1]) <= sum(vals[coins_taken + 1:]):
	coins_taken += 1
print(coins_taken + 1)


n = int(input())
l = list(map(int, input().split(' ')))
l.sort(reverse=True)
total = sum(l)
max = 0
i = 0
for j in l:
	i = i + 1
	max = max + j
	if max > int(total / 2):
		break
print(i)


n = int(input())
string = input()
arrC = string.split(' ')
array = [int(numeric_string) for numeric_string in arrC]
a = sum(array)
rs = 0
meC = 0
while True:
	meC += max(array)
	a -= max(array)
	array.pop(array.index(max(array)))
	rs += 1
	if a < meC:
		print(rs)
		break


n = int(input())
m = [int(n) for n in input().split()]
Mother = list(m)
len(Mother) == n
w = []
for i in range(len(Mother)):
	while sum(w) <= sum(Mother):
		w.append(max(Mother))
		Mother.remove(max(Mother))
print(len(w))


n = int(input())
a = [int(i) for i in input().split(' ')]
sum_coin = sum(a)
ref = sum_coin // 2
a.sort()
a.reverse()
rsum = 0
i = 0
count = 0
while rsum <= ref:
	rsum += a[i]
	count += 1
	i += 1
print(count)


n = int(input())
m = input().split()
m = list(map(int, m))
o = sorted(m)
o.reverse()
s1 = 0
for i in range(n):
	s1 += int(o[i])
s2 = 0
for j in range(n):
	s2 += int(o[j])
	if s2 > s1 / 2:
		print(j + 1)
		break


from collections import deque
import math
n = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
s1 = sum(arr) / 2
cnt = 0
s2 = 0
for i in range(0, n):
	s2 += arr[i]
	if s2 > s1:
		cnt += 1
		break
	else:
		cnt += 1
print(cnt)


n = int(input())
l = list(map(int, input().split()))
l.sort()
l = l[::-1]
Su = sum(l)
S = 0
k = 0
i = 0
while S <= Su:
	S = S + l[i]
	Su = Su - l[i]
	k = k + 1
	i = i + 1
print(k)


n = int(input())
money = list(map(int, input().split()))
suma = 0
for i in range(len(money)):
	suma = suma + money[i]
money.sort(reverse=True)
suma2 = 0
res = 0
for i in range(len(money)):
	suma2 = suma2 + money[i]
	res = res + 1
	if suma2 > suma - suma2:
		break
print(res)


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


n = int(input())
lst = [int(x) for x in input().split()]
lst.sort(reverse=True)
l = len(lst)
num = 0
s = 0
s2 = sum(lst)
for i in range(l):
	s += lst[i]
	num += 1
	if s <= s2 - s:
		continue
	else:
		break
print(num)


n = int(input())
list1 = list(map(int, input().split()))
list1.sort()
sum1 = count = 0
while sum1 <= sum(list1):
	sum1 += list1.pop()
	count += 1
print(count)


n = int(input())
avals = input().strip().split(' ')
avals = [int(a) for a in avals]
avals.sort(reverse=True)
tot = sum(avals)
s = 0
for i in range(n):
	s += avals[i]
	if s > tot - s:
		break
print(i + 1)


n = int(input())
coins = list(map(int, input().split()))
s = sum(coins)
coins = sorted(coins, reverse=True)
my = 0
mc = 0
for c in coins:
	my += c
	mc += 1
	if my > s / 2:
		break
print(mc)


n = int(input())
s = input()
s = s.split()
s = [int(i) for i in s]
ct = 0
s.sort()
x = sum(s) / 2
s = s[::-1]
y = 0
for i in s:
	y += i
	ct += 1
	if y > x:
		break
print(ct)


n = int(input())
coin_list = list(input().split())
x = [1] * n
coin_num = 0
a = 0
for i in range(n):
	x[i] = int(coin_list[i])
	x.sort(reverse=True)
	sum_coin = sum(x)
for i in range(n):
	if a + x[i] <= sum_coin / 2:
		coin_num += 1
	if a + x[i] > sum_coin / 2:
		coin_num += 0
	a += x[i]
coin_num += 1
print(coin_num)


n = int(input())
a = input().split(' ')
b = []
my_sum = 0
total_sum = 0
for c in a:
	b.append(int(c))
	total_sum += int(c)
b.sort()
b.reverse()
count = 0
for c in b:
	count += 1
	my_sum += c
	total_sum -= c
	if my_sum > total_sum:
		break
print(count)


n = int(input())
a = [int(n) for n in input().split()]
coins = [0 for n in range(101)]
coins_sum = 0
for i in a:
	coins[i] += 1
	coins_sum += i
got_coins_sum = 0
index = 100
count = 0
while got_coins_sum <= coins_sum / 2:
	if got_coins_sum + coins[index] * index <= coins_sum / 2:
		got_coins_sum += coins[index] * index
		count += coins[index]
		index -= 1
	else:
		got_coins_sum += index
		count += 1
print(count)


n = int(input())
c = sorted(map(int, input().split()))[::-1]
m = sum(c) / 2
(s, x) = (0, 0)
for i in c:
	s += i
	x += 1
	if s > m:
		print(x)
		break


int(input())
ar = sorted(map(int, input().split()))
sum1 = 0
count = 0
while sum1 <= sum(ar):
	sum1 += ar.pop()
	count += 1
print(count)


n = int(input())
s = input().split(' ')
s = sorted(s, key=lambda st: int(st))
su = 0
for i in range(n):
	su += int(s[i])
for i in range(n - 1, -1, -1):
	tempsum = 0
	for j in range(n - 1, i - 1, -1):
		tempsum += int(s[j])
	if tempsum > su - tempsum:
		print(n - i)
		break


numberOfCoins = int(input())
valueOfCoins = str(input())
valuesOfCoins = []
valuesOfCoins = valueOfCoins.split(' ')
valuesOfCoins = list(map(int, valuesOfCoins))
valuesOfCoins.sort(reverse=True)
for i in range(len(valuesOfCoins)):
	if i == 0:
		currentHead = int(valuesOfCoins[i])
		currentTail = int(sum(valuesOfCoins[i + 1:]))
		if currentTail < currentHead:
			print(str(i + 1))
			break
	if i > 0:
		currentHead = sum(valuesOfCoins[0:i + 1])
		currentTail = sum(valuesOfCoins[i + 1:])
		if currentHead > currentTail:
			print(str(i + 1))
			break


n = int(input())
m = list(map(int, input().split()))
number = m.sort()
tot = 0
value = 0
coins = 0
for x in range(n):
	tot += m[x]
for x in range(n):
	if value <= tot:
		value += m[-x - 1]
		coins += 1
		tot -= m[-x - 1]
print(coins)


n = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
sum1 = 0
for i in range(len(arr)):
	sum1 += arr[i]
sum2 = 0
minimum_coins = 1
for i in range(len(arr)):
	sum2 += arr[i]
	sum1 = sum1 - arr[i]
	if sum2 > sum1:
		print(minimum_coins)
		exit()
	else:
		minimum_coins += 1


n = int(input())
data = input()
alist = data.split()
blist = []
for i in alist:
	blist.append(int(i))
a = sorted(blist)
s = sum(a)
for i in range(len(a)):
	if sum(a[:i + 1]) >= s / 2:
		print(len(a) - i)
		break


n = int(input())
array = list(map(int, input().split()))
array.sort(reverse=True)
i = 0
total = sum(array)
total1 = 0
while total1 <= total - total1:
	total1 += array[i]
	i += 1
print(i)


n = int(input())
x = list(map(int, input().split()))
x.sort()
l = len(x)
c = 0
s = 0
cnt = 0
for i in x:
	s = s + i
for i in x[::-1]:
	c = c + i
	cnt += 1
	if c > s / 2:
		break
print(cnt)


n = int(input())
coins = [int(i) for i in input().split()]
sorted_coins = sorted(coins, reverse=True)
x = n
s1 = 0
s2 = sum(coins)
for i in sorted_coins:
	if s1 <= s2:
		s2 -= i
		s1 += i
		x = x - 1
print(n - x)


n = int(input())
q = list(map(int, input().split()))
x = 0
y = sum(q)
q.sort()
q.reverse()
for i in range(n):
	x += q[i]
	y -= q[i]
	if x > y:
		print(i + 1)
		break


def main():
	n = int(input())
	ls = list(map(int, input().split()))
	ls.sort(reverse=True)
	mid = sum(ls) // 2
	ctr = 0
	s = 0
	for i in ls:
		ctr += 1
		s += i
		if s > mid:
			break
	print(ctr)
main()


n = int(input())
coins = input().split(' ')
for (c, coin) in enumerate(coins):
	coins[c] = int(coin)
coins = sorted(coins, reverse=True)
s_coins = []
for i in range(len(coins)):
	s1 = coins[:i]
	s2 = coins[i:]
	if sum(s1) > sum(s2):
		s_coins.append(len(s1))
	elif sum(s1) < sum(s2):
		s_coins.append(len(s2))
print(sorted(s_coins)[0])


n = input()
coins = list(map(int, input().split(' ')))
coins = sorted(coins, reverse=True)
child1 = list()
child2 = list()
for i in coins:
	if sum(child1) <= sum(coins) // 2:
		child1.append(i)
print(len(child1))


n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
l = l[::-1]
k = 0
m = 0
kilk = 0
for i in range(n // 2 + 1):
	k = k + l[i]
	m = sum(l) - k
	if k <= m:
		kilk += 1
print(kilk + 1)


num = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
sum_coins = 0
for i in range(num):
	sum_coins += coins[i]
	if sum_coins * 2 > sum(coins):
		print(i + 1)
		break


n = int(input())
coin = list(map(int, input().split()))
total = sum(coin)
coin.sort(reverse=True)
mytotal = 0
mycoins = 0
half = total // 2
for i in coin:
	if mytotal > half:
		break
	mytotal += i
	mycoins += 1
print(mycoins)


n = int(input())
vals = sorted(map(int, input().split()[:n]))
total = sum(vals)
half = (total - 1) // 2
s = 0
for (i, v) in enumerate(vals):
	if s + v > half:
		break
	s += v
print(n - i)


a = int(input())
z = list(sorted(map(int, input().split())))
f = sum(z)
k = 0
for i in range(a - 1, -1, -1):
	k += z[i]
	f -= z[i]
	if k > f:
		print(a - i)
		exit()


coins = int(input())
values = input().split()
int_values = []
sums = []
for val in values:
	int_values.append(int(val))
int_values.sort()
for num in range(len(int_values)):
	if sum(int_values[num:]) > sum(int_values) - sum(int_values[num:]):
		sums.append(int_values[num:])
print(len(sums[-1]))


n = int(input())
a = input()
a = a.split()
for i in range(len(a)):
	a[i] = int(a[i])
a.sort(reverse=True)
twinmoney = sum(a)
mymoney = 0
coins = 0
while mymoney <= twinmoney and coins < n:
	mymoney += a[coins]
	twinmoney -= a[coins]
	coins += 1
print(coins)


n = int(input())
arr = list(map(int, input().split()))
arr = sorted(arr)
arr = arr[::-1]
(min, c) = (sum(arr) // 2, 0)
x = i = 0
while min >= x:
	x += arr[i]
	i += 1
	c += 1
print(c)


n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
sum = 0
temp = 0
ans = 0
for i in range(n):
	sum = sum + a[i]
for i in range(n):
	temp = temp + a[i]
	sum = sum - a[i]
	ans = ans + 1
	if temp > sum:
		break
print(ans)


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


n = int(input())
coins = list(map(int, input().split()))
maxSum = 0
remSum = sum(coins)
coinCount = 0
while remSum >= maxSum:
	maxSum += max(coins)
	remSum -= max(coins)
	coins.remove(max(coins))
	coinCount += 1
print(coinCount)


n = int(input())
a = list(map(int, input().split()))
a.sort()
b = sum(a)
c = 0
g = 0
while c <= b:
	c = c + a[len(a) - 1]
	b = b - a[len(a) - 1]
	a.remove(a[len(a) - 1])
	g = g + 1
print(g)


length = int(input())
coins = [int(item) for item in input().split(' ')]
coins.sort()
counter = 0
for x in coins:
	counter += x
number_of_coins = 0
coins_value = 0
counter = counter / 2
for x in reversed(coins):
	coins_value += x
	number_of_coins += 1
	if coins_value > counter:
		break
print(number_of_coins)


nums = input()
line = input()
numbers = list(reversed(sorted(map(int, line.split(' ')))))
me = sum(numbers[:len(numbers) // 2 + 1])
twin = sum(numbers[len(numbers) // 2 + 1:])
index = len(numbers) // 2
if me < twin:
	me = me + twin
	twin = 0
	index = len(numbers)
while me > twin:
	me = me - numbers[index]
	twin = twin + numbers[index]
	if me <= twin:
		print(index + 1)
		exit()
	index -= 1


numCoins = int(input())
nosInit = list(map(int, input().split()))
nos = sorted(nosInit, reverse=True)
tot = sum(nos)
minTot = tot / 2
sums = 0
count = 0
for i in range(numCoins):
	sums += nos[i]
	count += 1
	if sums > minTot:
		break
print(str(count) + '\n')


def twins(arr):
	if len(arr) == 1:
		return 1
	arr.sort()
	coins = []
	while arr:
		coins.append(arr.pop())
		if sum(coins) > sum(arr):
			return len(coins)
n = int(input())
x = list(map(int, input().rstrip().split()))
print(twins(x))


n = int(input())
coin = sorted([int(x) for x in input().split()])
all = sum(coin)
sum = 0
for i in range(n):
	sum += coin[n - i - 1]
	if sum > all - sum:
		print(str(i + 1))
		break


n = int(input())
N = list(map(int, input().split()))
l = []
l1 = []
for x in N:
	l.append(x)
l.sort(reverse=True)
for y in l:
	if sum(l1) <= sum(l):
		l = l[1:]
		l1.append(y)
print(len(l1))


n = int(input())
coins = input()
coins = coins.split()
l = []
coins1 = []
for item in coins:
	item = int(item)
	coins1.append(item)
total = sum(coins1)
for item in range(len(coins1)):
	l.append(max(coins1))
	coins1.remove(max(coins1))
accept = total / 2
running = 0
tot = 0
i = 0
while running <= accept:
	running += l[i]
	tot += 1
	i += 1
print(tot)


s = input()
s = input().split(' ')
s = [int(i) for i in s]
s.sort(reverse=True)
xsum = sum(s) / 2
csum = 0
for i in range(len(s)):
	csum = csum + s[i]
	if csum > xsum:
		print(i + 1)
		break


def main():
	QWE = 'river'
	INF = 10 ** 18 + 9
	EPS = 10 ** (-10)
	import sys, math, re
	n = int(input())
	a = []
	sm = 0
	for i in map(int, input().split(' ', n - 1)):
		a += [i]
		sm += i
	a.sort()
	rez = 0
	ans = 0
	for i in range(n - 1, -1, -1):
		rez += a[i]
		ans += 1
		if rez + rez > sm:
			break
	print(ans)
main()


n = int(input())
a = sorted(list(map(int, input().split())))
a.reverse()
sum_a = sum(a)
my_sum = 0
ans = 0
for i in range(len(a)):
	my_sum += a[i]
	sum_a -= a[i]
	ans += 1
	if my_sum > sum_a:
		print(ans)
		break


n = int(input())
nums = list(map(int, input().split(' ')))
nums.sort(reverse=True)
l = 0
while True:
	if sum(nums[:l]) > sum(nums[l:]):
		break
	l += 1
print(len(nums[:l]))


n = int(input())
coins = input().split()
for i in range(n):
	coins[i] = int(coins[i])
coins.sort()
coins.reverse()
s = sum(coins)
mine = 0
num = 0
for i in range(n):
	mine += coins[i]
	num += 1
	if mine > s / 2:
		break
print(num)


_ = int(input())
moedas = list(map(int, input().split()))
moedas.sort(reverse=True)
totMoedas = 0
somaMoedas = 0
valorTotal = sum(moedas)
while valorTotal / 2 >= somaMoedas:
	somaMoedas += moedas[totMoedas]
	totMoedas += 1
print(totMoedas)


x = int(input())
y = list(map(int, input().split()))
d = sum(y)
y.sort()
y = y[::-1]
c = 0
a = 0
for i in range(len(y)):
	a = a + y[i]
	c = c + 1
	if a > d - a:
		print(c)
		break


num = int(input())
value = sorted([int(x) for x in input().split()])[::-1]
total = sum(value)
n = 0
v = 0
for i in range(num):
	if value[i] + v > total - value[i] - v:
		print(i + 1)
		break
	else:
		v = v + value[i]
		continue


input()
coins = sorted(map(int, input().split()))
(sum_of_coins, num) = (0, 0)
while sum_of_coins <= sum(coins) / 2:
	sum_of_coins += coins[~num]
	num += 1
print(num)


count = int(input())
coins = [int(x) for x in input().split(' ')]
coins.sort(reverse=True)
fullsum = sum(coins)
left_money = 1
take_money = [coins[0]]
while sum(take_money) <= fullsum - sum(take_money):
	take_money.append(coins[left_money])
	left_money += 1
print(len(take_money))


n = int(input())
arr = [int(x) for x in input().split()]
sum1 = sum(arr)
sum1 = sum1 // 2
count = 0
sum2 = 0
arr.sort()
for i in range(len(arr) - 1, -1, -1):
	sum2 += arr[i]
	count += 1
	if sum2 > sum1:
		break
print(count)


b = 0
v = 0
m = -1
counter = 1
x = int(input())
if 1 <= x <= 100:
	z = list(map(int, input().split()))
	z.sort()
	for c in z:
		v = v + c
	a = z[m]
	b = v - z[m]
	while a <= b:
		m = m - 1
		a = a + z[m]
		b = b - z[m]
		counter += 1
	print(counter)


n = int(input())
qq = input().split(' ')
q = []
for i in qq:
	q.append(int(i))
q.sort()
q.reverse()
s = 0
for i in q:
	s += int(i)
w = 0
i = 0
while w <= s:
	w += int(q[i])
	s -= int(q[i])
	i += 1
print(i)


def count_coins(coins_values):
	needed_coins = 0
	my_coins_value = 0
	coins_values.sort(reverse=True)
	while len(coins_values) > 0 and sum(coins_values) >= my_coins_value:
		my_coins_value += coins_values[0]
		needed_coins += 1
		del coins_values[0]
	print(needed_coins)
number_of_coins = int(input())
coins_values = list(map(int, input().split()))
count_coins(coins_values)


n = int(input())
l = sorted(list(map(int, input().split())), reverse=True)
s = 0
p = sum(l)
for i in range(1, n + 1):
	a = sum(l[:i])
	if a > p - a:
		print(i)
		break


num = int(input())
coins = list(filter(lambda a: a != ' ', input().split()))
coins = sorted(list(map(int, coins)))
(count, summ) = (0, 0)
for i in range(num):
	summ += coins[num - i - 1]
	if summ > sum(coins) / 2:
		count = i
		break
print(count + 1)


n = int(input())
l = list(map(int, input().split(None, n)[:n]))
l.sort()
mm = sum(l) - l[len(l) - 1]
at = l[-1]
cont = 1
for i in range(len(l) - 2, -1, -1):
	if mm >= at:
		at += l[i]
		cont += 1
		mm -= l[i]
	else:
		break
print(cont)


c = int(input())
sum1 = sum2 = 0
arr = [int(i) for i in input().split()]
arr.sort()
arr.reverse()
for i in range(c):
	sum1 = sum1 + arr[i]
	for j in range(c):
		if j > i:
			sum2 = sum2 + arr[j]
	if sum1 > sum2:
		print(i + 1)
		break
	sum2 = 0


l = input()
arr = sorted(list(map(int, input().split())), reverse=True)
sum_ = 0
for i in range(len(arr)):
	sum_ += arr[i]
ans = 0
i = 0
while ans <= sum_ / 2:
	ans += arr[i]
	i += 1
print(i)


n = int(input())
coins = input()
coin_list = coins.split(' ')
total = 0
for i in range(len(coin_list)):
	coin_list[i] = int(coin_list[i])
	total += coin_list[i]
half = total / 2
coin_list.sort()
greedy = 0
coin_count = 0
for i in range(len(coin_list) - 1, -1, -1):
	greedy += coin_list[i]
	coin_count += 1
	if greedy > half:
		break
print(coin_count)


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
s = 0
x = 0
coins = 0
for i in range(len(l)):
	s += l[i]
for i in range(len(l) - 1, -1, -1):
	x += l[i]
	coins += 1
	s -= l[i]
	if x > s:
		break
print(coins)


n = int(input())
l = list(map(int, input().split()))
s = 0
c = 0
l.sort()
while 1:
	s += l.pop()
	c += 1
	if s > sum(l):
		print(c)
		break


n = int(input())
coins = [int(x) for x in input().split()]
coins.sort(reverse=True)
num_coins = 0
val_remaining = sum(coins)
val_used = 0
for coin in coins:
	if val_used <= val_remaining:
		val_used += coin
		val_remaining -= coin
		num_coins += 1
	else:
		break
print(num_coins)


n = int(input())
v = list(map(int, input().split(' ')))
if (n >= 1 and n <= 100) and (len(v) >= 1 and len(v) <= 100):
	j = len(v)
	res = 0
	for i in v:
		res += i
	x = res / 2
	for i in v:
		if res > x:
			h = max(v)
			res -= h
			v.remove(h)
		if res == x:
			v.remove(i)
			res -= i
	print(j - len(v))


n = int(input())
list = [int(a) for a in input().split(' ')]
list.sort(reverse=True)
sum = 0
brothSum = 0
for i in range(0, n):
	brothSum += list[i]
i = 0
while sum <= brothSum:
	sum += list[i]
	brothSum -= list[i]
	i += 1
print(i)


n = int(input())
arr = list(map(int, input().split()))
x = sum(arr)
arr.sort(reverse=True)
y = arr[0]
x = x - arr[0]
res = 1
for i in range(1, n):
	if y <= x:
		y = y + arr[i]
		x = x - arr[i]
		res = res + 1
	else:
		break
print(res)


n = input()
coins = list((int(x) for x in input().split(' ')))
coins.sort()
total = 0
count = 0
while total <= sum(coins):
	total += coins.pop()
	count += 1
print(count)


n = input()
l = input().split()
l = list(map(int, l))
l.sort(reverse=True)
avg = sum(l) / 2
c = 0
x = 0
for i in l:
	x += i
	c += 1
	if x > avg:
		break
print(c)


n = input()
A = list(map(int, input().split()))
s = sum(A) // 2
for i in range(len(A) - 1):
	for j in range(len(A) - i - 1):
		if A[j] > A[j + 1]:
			(A[j], A[j + 1]) = (A[j + 1], A[j])
s1 = 0
k = 0
for i in range(len(A) - 1, -1, -1):
	s1 = s1 + A[i]
	k += 1
	if s1 > s:
		break
print(k)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
sum1 = 0
for i in range(n):
	sum1 = sum1 + a[i]
import math
ave = math.floor(sum1 / 2)
y = 0
z = 0
for i in range(n):
	if y > ave:
		break
	else:
		y = y + a[i]
		z = z + 1
print(z)


a = int(input())
b = input()
b = b.split(' ')
b = map(int, b)
b = list(b)
b.sort()
b.reverse()
t = 0
r = 0
s = sum(b)
if sum(b) % 2 == 0:
	s = sum(b) // 2 + 1
else:
	s = sum(b) // 2 + 1
while r < s:
	r = r + b[t]
	t = t + 1
print(t)


n = input()
list1 = sorted(map(int, input().split()))
sum1 = sum(list1)
k = p = 0
while k <= sum1 / 2:
	k = k + list1[~p]
	p = p + 1
print(p)


n = int(input())
l = sorted(list(map(int, input().split())), key=lambda x: x * -1)
for i in range(len(l) + 1):
	if sum(l[:i]) > sum(l[i:]):
		print(i)
		break


x = int(input())
y = input().split()
z = []
for i in y:
	i = int(i)
	z.append(i)
z.sort()
z.reverse()
c = 0
k = 0
p = sum(z)
p = p / 2
for o in z:
	o = int(o)
	c += o
	k += 1
	if c > p:
		print(k)
		break


n = int(input())
a = list(map(int, input().split()))
s = sum(a)
a.sort(reverse=True)
tmp_sum = 0
cnt = 0
for elem in a:
	tmp_sum += elem
	cnt += 1
	if tmp_sum > s / 2:
		break
print(cnt)


n = input()
arr = list(map(int, input().split()))
total = sum(arr) >> 1
arr.sort(reverse=True)
ans = tmp = 0
for x in arr:
	if tmp > total:
		break
	ans += 1
	tmp += x
print(ans)


import math
n = int(input())
a = [int(x) for x in input().split()]
a.sort()
a.reverse()
all = 0
sum = 0
for i in range(n):
	all += a[i]
for i in range(n):
	sum += a[i]
	if sum > all // 2:
		print(i + 1)
		break


n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
totalValue = sum(a)
count = 0
s = 0
for i in a:
	s += i
	count += 1
	if s > totalValue - s:
		break
print(count)


n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
s = sum(a)
curs = 0
c = 0
for coin in a:
	curs += coin
	s -= coin
	c += 1
	if curs > s:
		print(c)
		break


total_coins = int(input())
coins_arr = list(map(int, input().split(' ')))
coins_arr.sort()
total_amount = sum(coins_arr)
my_money = 0
no_coins_taken = 0
while not my_money > total_amount:
	taken_coin = coins_arr.pop()
	my_money += taken_coin
	total_amount -= taken_coin
	no_coins_taken += 1
print(no_coins_taken)


n = int(input())
a = [int(i) for i in input().split()]
d = [0 for i in range(101)]
sum = 0
sum2 = 0
res = 0
res2 = 0
for i in range(n):
	sum += a[i]
	d[a[i]] += 1
j = 100
while sum - d[j] * j >= sum2 + d[j] * j:
	sum -= d[j] * j
	sum2 += d[j] * j
	res += d[j]
	j -= 1
res2 = (sum - sum2) // (2 * j)
res += res2
sum -= res2 * j
sum2 += res2 * j
print(res) if sum2 > sum else print(res + 1)


n = int(input())
coins = list(input().split())
coins = list(map(int, coins))
coins.sort(reverse=True)
total = 0
count = 0
for i in range(n):
	rest = sum(coins)
	if total <= rest:
		total = total + coins[i]
		coins[i] = 0
		count = count + 1
print(count)


input()
li = sorted(map(int, input().split()), reverse=True)
j = 1
for i in li:
	if sum(li[:j]) > sum(li[j:]):
		break
	j += 1
print(j)


coins_num = int(input())
coins_values = list(map(int, input().split()))
half_sum = int(sum(coins_values) / 2 + 1)
my_sum = 0
coins_values = sorted(coins_values)
j = len(coins_values) - 1
coins_count = 0
while my_sum < half_sum:
	my_sum += coins_values[j]
	coins_count += 1
	j -= 1
print(coins_count)


n = int(input())
a = [int(x) for x in input().split(' ')]
a.sort()
s = 0
i = 0
while s <= sum(a):
	s += a.pop()
	i += 1
print(i)


n = int(input().strip())
values = [int(i) for i in input().strip().split(' ')]
s = sum(values)
sortedDesc = sorted(values, reverse=True)
i = myS = 0
for c in sortedDesc:
	i += 1
	myS += c
	s -= c
	if myS > s:
		print(i)
		exit()


n = int(input())
coins = list(input().split(' '))
coins = [int(x) for x in coins]
coins_value = 0
answer = 0
my_value = 0
coins.sort(reverse=True)
for i in coins:
	coins_value += i
for x in coins:
	if my_value > coins_value:
		break
	else:
		my_value += x
		answer += 1
		coins_value -= x
print(answer)


n = int(input())
coins = list(map(int, input().split()))
total = sum(coins)
coins.sort(reverse=True)
me = 0
no_coins = 0
for c in coins:
	me += c
	no_coins += 1
	if me > total / 2:
		break
print(no_coins)


a = int(input())
li = [int(x) for x in input().split()]
b = 0
c = 0
num = 0
for x in li:
	c += x
while b <= c:
	b += max(li)
	li.remove(max(li))
	num += 1
	c = 0
	for x in li:
		c += x
print(num)


n = int(input())
a = sorted(list(map(int, input().split())))
a = a[::-1]
s = 0
count = 0
i = 0
while i < n:
	count += 1
	s += a[i]
	a.pop(0)
	if s > sum(a):
		break
print(count)


n = int(input())
l = [int(x) for x in input().split()]
t = l.copy()
s1 = 0
s2 = 0
c = 0
l.sort(reverse=True)
t.sort(reverse=True)
s2 = sum(l)
for i in range(len(l)):
	if s1 < s2 or s1 == s2:
		s1 = s1 + l[i]
		t.pop(0)
		s2 = sum(t)
		c = c + 1
print(c)


import sys
n = int(input())
jav = n
a = sorted(map(int, input().split()))
for i in range(n - 1, -1, -1):
	sum1 = sum(a[i:])
	sum2 = sum(a[:i])
	if sum1 > sum2:
		jav = n - i
		print(jav)
		sys.exit(0)
print(jav)


n = int(input())
coins = list(map(int, input().split()))
halfSum = sum(coins) / 2
coins.sort()
curSum = 0
i = 1
while curSum <= halfSum:
	curSum += coins[-1 * i]
	i += 1
print(i - 1)


input()
xs = list(map(int, input().split()))
xs.sort(reverse=True)
t = 0
k = 0
s = sum(xs)
for x in xs:
	if t > s:
		break
	t += x
	s -= x
	k += 1
print(k)


def Twins():
	n = input()
	c = list(input().split())
	coin = [int(i) for i in c]
	coin = sorted(coin, reverse=True)
	count = 0
	add = 0
	for i in coin:
		if add > sum(coin) / 2:
			return count
		add += i
		count += 1
	return len(coin)
print(Twins())


n = int(input())
a = list(map(int, input().split()))
flag = 0
if len(set(a)) == 1 and len(a) == 2:
	print(2)
	flag = 1
if len(a) == 1:
	print(1)
	flag = 1
a.sort()
a = a[::-1]
if flag == 0:
	for i in range(len(a)):
		if sum(a[0:i]) > sum(a[i:len(a)]):
			print(i)
			break


n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
l.reverse()
s = sum(l)
s = int(s / 2) + 1
c = 0
r = 0
for i in l:
	r = r + i
	c = c + 1
	if r >= s:
		break
print(c)


n = int(input())
m = [int(i) for i in input().split()]
m.sort()
m.reverse()
for i in range(n):
	if sum(m[:i + 1]) > sum(m[i + 1:]):
		print(i + 1)
		break


num = int(input())
coins = [int(i) for i in input().split(' ')]
numToSteal = sum(coins) // 2
cnt = 0
soFar = 0
x = len(coins)
for i in range(x):
	maxCoin = max(coins)
	cnt += 1
	soFar += maxCoin
	if soFar > numToSteal:
		print(cnt)
		break
	coins.remove(maxCoin)


aa = 0

def fun(sum, i, ans, sum2, j):
	if i == j:
		if sum + aa[i] < sum2:
			return ans
		else:
			return ans + 1
	if sum < sum2:
		return fun(sum + aa[i], i + 1, ans, sum2, j)
	else:
		return fun(sum, i, ans + 1, sum2 + aa[j], j - 1)
ln = int(input())
aa = input().split(' ')
for x in range(ln):
	aa[x] = int(aa[x])
aa.sort()
print(fun(0, 0, 0, 0, ln - 1))


o = input()
a = input()
a = a.split(' ')
b = []
c = len(a)
d = 0
sum = 0
while d < c:
	b.append(int(a[d]))
	sum = sum + int(a[d])
	d = d + 1
b.sort()
max = 0
d = d - 1
while d >= 0:
	max = max + b[d]
	if max > sum / 2:
		break
	d = d - 1
print(c - d)


n = int(input())
j = input().split(' ')
a = []
for i in range(0, n):
	a.append(int(j[i]))
a.sort(reverse=True)
count = 0
k = 0
c = 0
for i in range(0, n):
	count = count + a[i]
count = count / 2
for i in range(0, n):
	k = k + a[i]
	c = c + 1
	if k > count:
		break
print(c)


n = int(input())
nums = list(map(int, input().split()))
totalSum = 0
coinsSum = 0
coinsQty = 0
index = n - 1
nums.sort()
for i in range(n):
	totalSum = totalSum + nums[i]
while coinsSum <= totalSum and index > -1:
	totalSum = totalSum - nums[index]
	coinsSum = coinsSum + nums[index]
	coinsQty = coinsQty + 1
	index = index - 1
print(coinsQty)


from sys import stdin
n = int(stdin.readline())
m = [int(x) for x in stdin.readline().split()]
m = sorted(m, reverse=True)
me = [m[0]]
for i in range(1, n):
	if sum(me) > sum(m[i:]):
		me = me
	else:
		me = me + [m[i]]
print(len(me))


(a, b, i) = (int(input()), sorted(tuple(map(int, input().split())), reverse=True), 0)
while sum(b[:i + 1]) < sum(b) // 2 + 1:
	i += 1
print(i + 1)


import math
n = int(input())
l = [int(i) for i in input().split()]
k = sum(l) / 2
l.sort(reverse=True)
m = 0
d = 0
for i in range(n):
	if m <= k:
		m = m + l[i]
		d += 1
	else:
		break
print(d)


numMoedas = int(input())
valores = list(map(int, input().split()))
valorMoedas = list((int(valores[i]) for i in range(numMoedas)))
valorMoedas.sort(reverse=True)
totalMoedas = sum(valorMoedas)

def calcula(soma, subtracao, i):
	if subtracao >= soma:
		moedaAtual = valorMoedas[i]
		calcula(soma + moedaAtual, subtracao - moedaAtual, i + 1)
	else:
		print(i)
calcula(0, totalMoedas, 0)


n = int(input())
v = [int(i) for i in input().split()]
v.sort()
v.reverse()
s = sum(v)
s1 = 0
s2 = s
for i in range(n):
	s1 = s1 + v[i]
	s2 = s2 - v[i]
	if s1 > s2:
		print(i + 1)
		break


n = int(input())
a = list(map(int, input().split()))
s = 0
for i in range(n):
	s += a[i]
i = 0
s1 = 0
a.sort()
while s1 + a[i] < s // 2 + s % 2 * 1:
	s1 += a[i]
	n -= 1
	i += 1
print(n)


x = int(input())
v = list(map(int, input().split()))
sum = sum(v)
v.sort(reverse=True)
sum2 = 0
count = 0
for i in range(0, x):
	if sum2 <= sum:
		sum2 += v[i]
		count += 1
		sum -= v[i]
	else:
		break
print(count)


input()
coins = sorted([int(coin) for coin in input().split()])
mid = sum(coins) / 2
my_sum = 0
for i in range(len(coins) - 1, -1, -1):
	my_sum += coins[i]
	if my_sum > mid:
		print(len(coins) - i)
		exit(0)


n = int(input())
li = []
k = list(map(int, input().split()))
s = max(k)
li.append(s)
k.remove(s)
for i in range(n):
	if s > sum(k):
		print(len(li))
		break
	else:
		li.append(max(k))
		s += max(k)
		k.remove(max(k))


n = int(input())
values = input().split()
values = [int(x) for x in values]
values.sort(reverse=True)
totalSum = sum(values)
rightSum = 0
for i in range(n):
	rightSum += values[i]
	if rightSum > totalSum - rightSum:
		print(i + 1)
		break


def string_task(coins):
	coins = [int(i) for i in coins]
	mine = []
	coins = list(reversed(sorted(coins)))
	while len(coins) >= 0:
		if sum(mine) > sum(coins):
			return len(mine)
		else:
			mine.append(coins[0])
			del coins[0]
total_coins = input()
coins = input().split()
print(string_task(coins))


n = int(input())
l = sorted(list(map(int, input().split(' '))), reverse=True)
(m, p) = (0, 0)
for i in range(len(l)):
	m += l[i]
	p += 1
	if m > sum(l) / 2:
		break
print(p)


n = int(input())
coins_values = [int(x) for x in input().split()]
coins_values.sort(reverse=True)
totalArgent = sum(coins_values)
argentMoitie = int(totalArgent / 2) + 1
nbCoins = 0
for a in coins_values:
	argentMoitie -= a
	nbCoins += 1
	if argentMoitie <= 0:
		break
print(nbCoins)


n = int(input())
mas = sorted(list(map(int, input().split())))
mas = mas[::-1]
S = sum(mas)
New = 0
Cnt = 0
for i in range(n):
	New += mas[i]
	S -= mas[i]
	Cnt += 1
	if New > S:
		print(Cnt)
		break


a = int(input(''))
b = input('')
f = []
for m in b.split(' '):
	f.append(int(m))
c = sorted(f)
i = a - 1
m = 0
while i < a:
	sum1 = 0
	sum2 = 0
	count = 0
	d = c[0:i]
	e = c[i:a]
	for x in d:
		sum1 = sum1 + int(x)
	for y in e:
		sum2 = sum2 + int(y)
		count = count + 1
	if sum2 <= sum1:
		i = i - 1
		continue
	elif sum2 > sum1:
		print(count)
		break


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
for i in range(len(coins) + 1):
	mySum = sum(coins[:i])
	hisSum = sum(coins[i:])
	if mySum > hisSum:
		print(i)
		break


def minimum(coins):
	_sum = 0
	half = sum(coins) / 2
	counter = 0
	for i in range(len(coins) - 1, -1, -1):
		_sum += coins[i]
		counter += 1
		if _sum > half:
			break
	return counter
n = int(input())
values = [int(c) for c in input().split(' ')]
values.sort()
print(minimum(values))


def go():
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	a.sort(reverse=True)
	c = 0
	i = 0
	while sum(a[i:]) >= c:
		c += a[i]
		i += 1
	return i
print(go())


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
rem_s = sum(l)
cur_s = 0
count = 0
for i in range(n):
	if cur_s > rem_s:
		break
	rem_s -= l[i]
	cur_s += l[i]
	count += 1
print(count)


import collections
n = int(input())
user_input = list(map(int, input().split()))
user_input.sort(reverse=True)
sum = sum(user_input)
sum_a = 0
sum_b = sum
for i in range(n):
	sum_a += user_input[i]
	sum_b -= user_input[i]
	if sum_a > sum_b:
		print(i + 1)
		break


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


number = int(input())
data = list(map(int, input().split()))
data.sort(reverse=True)
half = int(sum(data) / 2)
(count, add) = (0, 0)
for m in data:
	add += m
	count += 1
	if add > half:
		print(count)
		break


x = int(input())
l = list(map(int, input().split()))
tr = 0
for i in l:
	tr += i
m = l
s = 0
k = 0
while True:
	p = max(m)
	s += 1
	k += p
	m.remove(p)
	if k > tr / 2:
		break
print(s)


input()
coins = []
for i in input().split(' '):
	coins.append(int(i))
myMoney = 0
theirMoney = sum(coins)
minCoinsNeeded = 0
while myMoney <= theirMoney:
	myMoney += max(coins)
	coins.remove(max(coins))
	theirMoney = sum(coins)
	minCoinsNeeded += 1
print(minCoinsNeeded)
exit()


n = int(input())
l = list(map(int, input().split(' ')))
l.sort(reverse=True)
coin = 0
total_sum = sum(l)
current_sum = 0
for i in range(len(l)):
	coin += 1
	current_sum = current_sum + l[i]
	remaining_sum = total_sum - current_sum
	if current_sum > remaining_sum:
		break
print(coin)


n = int(input().strip())
a = [int(x) for x in input().strip().split(' ')]
a.sort(reverse=True)
s = sum(a)
c = 0
sum = 0
u = 0
for i in a:
	if sum > s:
		break
	u = i
	sum += u
	s = s - u
	c += 1
print(c)


num = int(input())
val1 = []
val = input().split(' ')
sum = 1
cnt = 0
sumg = 0
for i in val:
	val1.append(int(i))
	sum += int(i)
val1.sort()
val1.reverse()
if num == 0:
	print(0)
	exit()
elif num == 1:
	print(1)
	exit()
else:
	for i in val1:
		if sumg / sum < 0.5:
			sumg += i
			cnt += 1
if sumg / sum >= 0.5:
	print(cnt)
else:
	print(cnt)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
t = sum(a) / 2
s = 0
k = 0
while s <= t:
	s += a[0]
	k += 1
	del a[0]
print(k)


t = int(input())
nums = list(map(int, input().split()))
nums.sort()
total = []
for j in range(len(nums)):
	for k in range(j + 1, len(nums) + 1):
		a = nums[0:j + 1]
		b = nums[j + 1:len(nums) + 1]
	if sum(a) > sum(b):
		total.append(len(a))
for j in range(len(nums)):
	for k in range(j + 1, len(nums) + 1):
		a = nums[0:j + 1]
		b = nums[j + 1:len(nums) + 1]
	if sum(a) < sum(b):
		total.append(len(b))
print(min(total))


n = int(input())
l = list(map(int, input().split()))
total = sum(l)
current = 0
answer = 0
l = sorted(l, reverse=True)
for a in l:
	current += a
	total -= a
	answer += 1
	if current > total:
		print(answer)
		break


coins_amount = int(input())
nominals = list(map(int, input().split()))
for i in range(len(nominals) - 1):
	for j in range(len(nominals) - i - 1):
		if nominals[j] < nominals[j + 1]:
			(nominals[j + 1], nominals[j]) = (nominals[j], nominals[j + 1])
count = 0
my_sum = 0
brother_sum = sum(nominals)
for i in range(len(nominals)):
	my_sum += nominals[i]
	brother_sum -= nominals[i]
	if my_sum > brother_sum:
		count = i + 1
		break
print(count)


n = int(input())
y = str(input())
v = y.split()
for i in range(n):
	v[i] = int(v[i])
v.sort(reverse=True)
s = 0
for i in range(n):
	s = s + v[i]
a = s
b = 0
for i in range(n):
	a -= v[i]
	b += v[i]
	if b > a:
		break
print(i + 1)


n = int(input())
lis = [int(x) for x in input().split()]
s = sum(lis)
lis.sort()
lis.reverse()
x = 0
i = 0
while x <= s // 2:
	x += lis[i]
	i += 1
print(i)


n = int(input())
a = [int(x) for x in input().split()]
l = len(a)
p = sorted(a, reverse=True)
s2 = 0
s1 = sum(p)
for i in range(l):
	s2 += p[i]
	if s2 > s1 - s2:
		print(i + 1)
		break
	else:
		continue


input()
n = sorted(map(int, input().split()))
check_num = int(sum(n) / 2 + 1)
n.reverse()
coun = 0
result = 0
for i in range(len(n)):
	coun += 1
	result += n[i]
	if result >= check_num:
		print(coun)
		break


n = int(input())
l = list(map(int, input().split()))
l.sort()
m = sum(l) / 2
tot = [0 for _ in range(n)]
tot[0] = l[0]
for i in range(n):
	tot[i] = l[i] + tot[i - 1]
for i in range(n):
	if tot[n - i - 1] < m:
		print(i)
		exit()
print(n)


p = int(input())
word = input()
list = word.split(' ')
arr = []
for i in range(len(list)):
	arr.append(int(list[i]))
arr.sort()
arr.reverse()
total = 0
for i in range(len(arr)):
	total += arr[i]
n = 0
self = 0
left = 0
res = []
for i in range(p):
	self = self + arr[i]
	left = total - self
	if self > left:
		res.append(n + 1)
	n = n + 1
print(res[0])


n = int(input())
d = [int(x) for x in input().split()]
d.sort(reverse=True)
t = tuple(d)
s = []
for i in t:
	s.append(i)
	d.remove(i)
	if sum(s, 0) > sum(d, 0):
		print(len(s))
		break


import sys
len = sys.stdin.readline()
mon = sys.stdin.readline().strip().split(' ')
len = int(len)
for i in range(0, len):
	mon[i] = int(mon[i])

def sort(list):
	f = False
	while not f:
		f = True
		for i in range(0, len - 1):
			if list[i] < list[i + 1]:
				f = False
				(list[i], list[i + 1]) = (list[i + 1], list[i])
	return list
mon = sort(mon)
summ = 0
for i in range(0, len):
	summ = mon[i] + summ
i = 0
msum = 0
while i < len and 2 * msum <= summ:
	msum = msum + mon[i]
	i = i + 1
print(i)


a = int(input())
b = 0
c = 0
n = list(map(int, input().split()))
total = sum(n)
n.sort()
while b <= total // 2:
	b += n[-1]
	n.pop()
	c += 1
print(c)


x = int(input())
maxi = [int(x) for x in input().split()]
maxi.sort()
summ = 0
summ2 = 0
a = 1
for i in maxi:
	summ = summ + i
while summ2 <= summ / 2:
	summ2 = summ2 + maxi[len(maxi) - a]
	a += 1
print(a - 1)


n = int(input())
a = list(map(int, input().split()))
a.sort()
(s1, s2, count) = (sum(a[:-1]), a[-1], 1)
while True:
	if s1 < s2:
		print(count)
		break
	else:
		count += 1
		s1 -= a[-count]
		s2 += a[-count]


n = int(input())
m = input().split()
t = 0
t2 = 0
t3 = 0
for i in range(len(m)):
	m[i] = int(m[i])
m = sorted(m)
for i in range(n):
	t = t + m[i]
i = 0
if i <= n:
	while t2 <= t / 2:
		t2 = t2 + m[n - (i + 1)]
		t3 = t3 + 1
		i = i + 1
print(t3)


n = int(input())
coin = input().split()
coin = list(map(int, coin))
coin = sorted(coin)
sum = 0
for j in coin:
	sum = sum + j
part = 0
h = 1
while h <= n:
	part = part + coin[-h]
	if part > sum / 2:
		print(h)
		break
	h = h + 1


from sys import stdin, stdout
number_of_coins = int(stdin.readline().rstrip())
coins = [int(x) for x in stdin.readline().rstrip().split(' ')]
coins.sort(reverse=True)
threshold = sum(coins) / 2
collected_sum = 0
for i in range(number_of_coins):
	collected_sum += coins[i]
	if collected_sum > threshold:
		break
stdout.write(str(i + 1))


import sys

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

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

def input():
	return sys.stdin.readline().strip()
n = int(input())
Arr = get_array()
Arr.sort()
total = sum(Arr) - Arr[-1]
my_initial = Arr[-1]
i = n - 2
coins = 1
while i >= 0:
	if my_initial > total:
		break
	my_initial += Arr[i]
	total -= Arr[i]
	i = i - 1
	coins += 1
print(coins)


n = int(input())
l = list(map(int, input().split()))
s = sum(l)
l.sort(reverse=True)
x = 0
count = 0
for i in range(n):
	if x > s / 2:
		break
	else:
		x = x + l[i]
		count = count + 1
print(count)


n = [int(i) for i in input().split()][0]
a = [int(i) for i in input().split()]
a = sorted(a)
for i in range(n - 1, -1, -1):
	if sum(a[:i]) < sum(a[i:]):
		ans = n - i
		break
print(ans)


import os
import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from io import BytesIO, IOBase
from itertools import accumulate, combinations, combinations_with_replacement, groupby, permutations, product
from math import acos, asin, atan, ceil, cos, degrees, factorial, hypot, log2, pi, radians, sin, sqrt, tan
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits

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

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

def instr():
	s = input()
	return list(s[:len(s)])

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

def def_value():
	return 0

def main():
	n = inp()
	a = inlist()
	a = sorted(a, reverse=True)
	pref = [a[0]]
	for i in range(1, n):
		pref.append(pref[i - 1] + a[i])
	for i in range(n):
		b1 = pref[i]
		b2 = pref[n - 1] - pref[i]
		if b1 > b2:
			print(i + 1)
			break
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')
main()


n = int(input())
A = list(map(int, input().split()))
A.sort()
csum = 0
max_sum = sum(A)
i = len(A) - 1
count = 0
while csum <= max_sum - csum:
	csum += A[i]
	i -= 1
	count += 1
print(count)


n = int(input())
values = [int(value) for value in input().split(' ')]
values.sort(reverse=True)
sum = 0
for value in values:
	sum += value
i = 0
count = 0
fsum = 0
while i < n:
	fsum += values[i]
	count += 1
	sum = sum - values[i]
	if fsum > sum:
		print(count)
		break
	i += 1


n = int(input())
a = input()
a = [int(x) for x in a.split()]
a = sorted(a)
coins = 1
me = a[-1]
a.pop(-1)
rest = sum(a[:])
while me <= rest:
	me += a[-1]
	rest -= a[-1]
	a.pop(-1)
	coins += 1
print(coins)


temp = input()
data = input()
data = data.split()
for i in range(len(data)):
	data[i] = int(data[i])
data.sort()
data = data[::-1]
for i in range(len(data) + 1):
	if sum(data[0:i]) > sum(data[i:]):
		print(i)
		break


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
mincoins = 0
i = 1
while i <= n:
	x = sum(coins[:i])
	y = sum(coins[i:])
	if x > y:
		mincoins += 1
		break
	else:
		mincoins += 1
		i += 1
print(mincoins)


n = int(input())
lst = list(map(int, input().split()))
total = 0
cnt = 0
for i in sorted(lst, reverse=True):
	cnt += 1
	total += i
	if total > sum(lst) / 2:
		break
print(cnt)


l = lambda : map(int, input().split())
n = int(input())
a = list(l())
a.sort()
sum1 = 0
count = 0
while sum(a) >= sum1:
	sum1 = sum1 + a.pop()
	count = count + 1
print(count)


from math import floor

def main():
	n = int(input())
	coinList = list(map(int, input().split()))
	coinList.sort(reverse=True)
	halfTotal = floor(sum(coinList) / 2)
	coinToTake = 0
	total2 = 0
	count = 0
	i = 0
	while True:
		total2 = total2 + coinList[coinToTake]
		coinToTake += 1
		if total2 > halfTotal:
			break
	print(coinToTake)
main()


n = int(input())
coins = list(map(int, input().split()))
total = sum(coins)
coins.sort(reverse=True)
itake = 1
account = 0
for coin in coins:
	account += coin
	if account <= total / 2:
		itake += 1
	else:
		break
print(itake)


n = int(input())
l = sorted(list(map(int, input().split())), reverse=True)
s = sum(l) // 2
for k in range(n):
	s -= l[k]
	if s < 0:
		print(k + 1)
		break


import math
x = int(input())
y = input().split()
for i in range(len(y)):
	y[i] = int(y[i])
y.sort(reverse=True)
for i in range(len(y)):
	x = sum(y[0:i + 1])
	if x > sum(y[i + 1:len(y)]):
		print(i + 1)
		break


n = int(input())
x = [int(s) for s in input().split()]
x.sort(reverse=True)
mid = 1
while sum(x[0:mid]) <= sum(x[mid:]):
	mid += 1
print(len(x[0:mid]))


n = int(input())
x = [int(q) for q in input().split()]
s = sum(x) // 2
a = 0
t = 0
z = sorted(x)
for i in range(n):
	if a <= s:
		a += z[i]
		t += 1
b = 0
u = 0
y = z[::-1]
for i in range(n):
	if b <= s:
		b += y[i]
		u += 1
print(min(t, u))


n = int(input())
p = input()
p = p.split()
s = 0
for i in range(n):
	p[i] = int(p[i])
	s += p[i]
p.sort(reverse=True)
c = 0
for i in range(n):
	s -= p[i]
	c += p[i]
	if s < c:
		break
if i == n:
	print(n)
else:
	print(i + 1)


input()
L = [int(_) for _ in input().split()]
L.sort()
L.reverse()
T1 = C = 0
T2 = sum(L)
for i in L:
	if T1 <= T2:
		T1 += i
		T2 -= i
		C += 1
else:
	print(C)


a = int(input())
b = input().split()
for i in range(len(b)):
	b[i] = int(b[i])
b.sort(reverse=True)
count = 1
s = 0
for i in range(a):
	s += b[i]
	s1 = 0
	for j in range(i + 1, a):
		s1 += b[j]
	if s > s1:
		break
	else:
		count += 1
print(count)


n = int(input())
l = list(map(int, input().split()))
l = sorted(l, reverse=True)
(summ, countt, left) = (0, 0, l[0])
for i in l:
	summ = summ + i
half = summ / 2
if len(l) == 1:
	print(1)
for i in range(1, len(l)):
	if left < half:
		countt += 1
		left = left + l[i]
	elif left == half:
		print(countt + 2)
		break
	else:
		print(countt + 1)
		break


def getTotalAmount(coins):
	res = 0
	for coin in coins:
		res += coin
	return res

def divideCoints(coins):
	coins.sort(reverse=True)
	halfAmount = getTotalAmount(coins) // 2
	count = 0
	i = 0
	while halfAmount > 0 and i < len(coins):
		halfAmount -= coins[i]
		count += 1
		i += 1
	if halfAmount == 0:
		count += 1
	return count

def run():
	n = int(input())
	coins = list(map(int, input().split()))
	print(divideCoints(coins))
run()


num_coins = int(input())
coins = list(map(int, input().split()))
total_money = sum(coins)
coins.sort(reverse=True)
my_money = 0
for idx in range(len(coins)):
	my_money += coins[idx]
	if my_money > total_money - my_money:
		break
print(idx + 1)


n = int(input())
nominals = [int(data) for data in input().split()]
nominals.sort()
my_coins = 0
my_sum = 0
while my_sum <= sum(nominals):
	my_sum = my_sum + nominals.pop()
	my_coins = my_coins + 1
print(my_coins)


import sys
data = sys.stdin.read().strip()
data = data.split('\n')
num = int(data[0])
coins = data[1].split(' ')
for (i, item) in enumerate(coins):
	coins[i] = int(item)
coins.sort(reverse=True)
total = 0
for item in coins:
	total += item
take = 0
taken = 0
for (i, item) in enumerate(coins):
	if taken > total:
		take = i
		break
	else:
		taken += item
		total -= item
if take == 0:
	take = len(coins)
print(take)


n = int(input())
ls = list(map(int, input().split()))
sum = 0
ls.sort()
ls = ls[::-1]
for i in ls:
	sum += i
sumofcoins = sum // 2
c = 0
co = 0
for i in ls:
	c += i
	co += 1
	if c > sumofcoins:
		break
print(co)


n = int(input())
val = input().split()
fq = 101 * [0]
for i in range(n):
	fq[int(val[i])] += 1
s = 0
for i in range(101):
	s += i * int(fq[i])
ma = 0
d = 0
for i in range(100, 0, -1):
	while fq[i] > 0:
		if ma > int(s / 2):
			break
		else:
			d += 1
			ma += i
			fq[i] -= 1
print(d)


quntCoins = int(input())
values = list(map(int, input().split()))
if quntCoins == 1:
	print(1)
elif quntCoins == 2:
	if values[0] == values[1]:
		print(2)
	else:
		print(1)
else:
	values.sort()
	sum = 0
	for i in range(len(values)):
		sum += values[i]
	sumCoins = 0
	qtd = 0
	i = -1
	while sumCoins <= sum / 2:
		sumCoins += values[i]
		i -= 1
		qtd += 1
	print(qtd)


a = input()
b = input()
b = b.split(' ')
for i in range(int(a)):
	b[i] = int(b[i])
b.sort()
b.reverse()
count = 0
i1 = 0
i2 = sum(b)
for i in range(len(b)):
	i1 = i1 + b[i]
	i2 = i2 - b[i]
	count = count + 1
	if i1 > i2:
		break
print(count)


no_of_coins = int(input())
weights = sorted([int(i) for i in input().split(' ')], reverse=True)
my_sum = 0
printed = False
total = sum(weights)
for i in range(no_of_coins):
	if my_sum <= total - my_sum:
		my_sum += weights[i]
	else:
		print(i)
		printed = True
		break
if not printed:
	print(no_of_coins)


n = int(input())
a = list(map(int, input().split()))
coins = sum(a)
a.sort(reverse=True)
count = 0
mine = 0
for i in a:
	if mine > coins / 2:
		break
	mine += i
	count += 1
print(count)


a = int(input())
b = list(map(int, input().split()))
count = 0
b.sort(reverse=True)
Sum = sum(b)
half = Sum / 2
d = 0
for i in range(a):
	d = d + b[i]
	count = count + 1
	if d > half:
		print(count)
		break


n = input()
coins = list(map(int, input().split()))
half = sum(coins) / 2
min_coins = 0
cur = 0
coins.sort(reverse=True)
for i in coins:
	cur += i
	min_coins += 1
	if cur > half:
		print(min_coins)
		break


number_of_coins = int(input())
coins = list(map(int, input().split()))
total = 0
count = 0
coins.sort(reverse=True)
avg = sum(coins) / 2
for coin in coins:
	total += coin
	count += 1
	if total > avg:
		break
print(count)


test = int(input())
arr = input().split()
for i in range(test):
	arr[i] = int(arr[i])
arr.sort()
total = sum(arr)
tota = 0
j = 0
for i in range(len(arr) - 1, -1, -1):
	tota = tota + arr[i]
	j = j + 1
	if 2 * tota > total:
		print(j)
		break


n = int(input())
a = list(map(int, input().split()))
half = sum(a) / 2
a.sort(reverse=True)
ctr = 0
s = 0
c = 0
while s <= half:
	s += a[c]
	c += 1
	ctr += 1
print(ctr)


def main():
	n = int(input())
	coin = input().split()
	a = []
	for x in coin:
		a.append(x)
	a = [int(x) for x in a]
	a.sort(key=int, reverse=True)
	m = 1
	l = len(a)
	loop = True
	while loop is True:
		if sum(a[0:m]) > sum(a[0:l]) - sum(a[0:m]):
			loop = False
			print(len(a[0:m]))
		else:
			m += 1
main()


n = int(input())
coin = list(map(int, input().rstrip().split()))
half1 = 0
half2 = sum(coin)
coin.sort()
coin.reverse()
count = 0
for i in range(n):
	if half1 > half2:
		break
	else:
		half1 += coin[i]
		half2 -= coin[i]
		count += 1
print(count)


a = input()
x = map(int, input().split(' '))
b = sorted(x)
sum = 0
for item in b:
	sum = sum + item
c = b[::-1]
count = 0
d = sum / 2
sums = 0
while sums <= d:
	for i in c:
		if sums > d:
			break
		else:
			sums = sums + i
			count += 1
print(count)


l = int(input())
coins = []
li = input()
for i in li.split():
	coins.append(int(i))
total = sum(coins)
coins = sorted(coins)
i = 1
j = len(coins) - 1
s = coins[-1]
while s <= sum(coins[:j]):
	j -= 1
	s += coins[j]
	i += 1
print(i)


n = int(input())
L = [int(x) for x in input().split()]
money = sum(L)
for i in range(n + 1):
	if sum(L) >= money / 2:
		L.remove(max(L))
	else:
		print(i)
		break


n = int(input())
ipt = [int(x) for x in input().split()]
ipt.sort(reverse=True)
for i in range(1, n + 1):
	slice1 = ipt[:i]
	slice2 = ipt[i:]
	if sum(slice1) > sum(slice2):
		print(len(slice1))
		break


n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
for i in range(len(a)):
	if len(a) == 1:
		print(1)
		break
	if len(a) == 2 and a[0] == a[1]:
		print(2)
		break
	if sum(a[0:i]) > sum(a[i:]):
		print(i)
		break


n = int(input())
coins = [int(i) for i in input().split()]
coins.sort(reverse=True)
cnt = 0
taken = 0
remained = sum(coins)
for i in coins:
	if taken > remained:
		break
	taken += i
	remained -= i
	cnt += 1
print(cnt)


n = int(input(''))
s = sorted(list(map(lambda x: int(x), input('').split(' '))), reverse=True)
for i in range(n):
	if sum(s[:i]) > sum(s[i:]):
		print(i)
		break
	elif n == 2 and s[0] == s[1]:
		print(n)
		break
	elif n == 1:
		print(1)
		break


def gaps(s_left, s_right):
	suml = 0
	sumr = 0
	for i in s_left:
		suml += i
	for i in s_right:
		sumr += i
	return suml < sumr
n = int(input())
s = input().split()
s = [int(i) for i in s]
for i in range(n):
	for j in range(i, n):
		if s[i] > s[j]:
			(s[i], s[j]) = (s[j], s[i])
i = 1
s_left = s[:n - 1]
s_right = s[n - 1:]
while not gaps(s_left, s_right):
	s_left = s[:n - 1 - i]
	s_right = s[n - 1 - i:]
	i += 1
print(i)


def main():
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	s = sum(a)
	n = len(a) - 1
	cur = 0
	while n >= 0:
		if cur + a[n] > s - a[n]:
			print(len(a) - n)
			return 0
		cur += a[n]
		s -= a[n]
		n -= 1
	return 0
main()


numbers = []
Sum = 0
count = 0
SumOfList = 0
i = 0
size = int(input())
nums = input()
while i < size:
	numbers.append(int(nums.split()[i]))
	i += 1
numbers.sort(reverse=True)
for i in numbers:
	SumOfList += i
for i in numbers:
	Sum += i
	count += 1
	if Sum > SumOfList - Sum:
		break
print(count)


t = int(input(''))
L = input('').split(' ')
for i in range(t):
	L[i] = int(L[i])
L.sort(reverse=True)
list_sum = 0
for j in range(t):
	list_sum += int(L[j])
pre_sum = 0
for k in range(t):
	pre_sum += int(L[k])
	post_sum = list_sum - pre_sum
	if post_sum < pre_sum:
		print(k + 1)
		break


y = int(input())
x = input().split(' ')
x = list(map(int, x))
for i in range(1, len(x)):
	j = i - 1
	nxt_element = x[i]
	while x[j] > nxt_element and j >= 0:
		x[j + 1] = x[j]
		j = j - 1
	x[j + 1] = nxt_element
sum = 0
t_sum = 0
count = 0
for i in range(len(x)):
	t_sum += int(x[i])
for i in range(len(x) - 1, -1, -1):
	sum += int(x[i])
	count += 1
	if sum > t_sum - sum:
		break
print(count)


n = int(input())
line = [int(i) for i in input().split()]
line.sort()
money = 0
c = 0
for i in reversed(line):
	money += i
	c += 1
	if money > 0.5 * sum(line):
		print(c)
		break


input()
coins = []
sum1 = 0
sum2 = 0
for i in input().split(' '):
	coins.append(int(i))
num = 0
sum2 = sum(coins)
coins.sort(reverse=True)
for v in coins:
	num += 1
	sum1 += v
	if sum1 > sum2 - sum1:
		break
print(num)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = 0
mn = 100000000000
f = 1
for i in range(len(a)):
	if sum(a[:i + 1]) > sum(a[i + 1:]):
		mn = min(mn, i + 1)
		f = 0
if f:
	mn = n
print(mn)


n = int(input())
l = [int(i) for i in input().split()]
l.sort(reverse=True)
s = sum(l)
(c, add) = (0, 0)
for i in range(len(l)):
	if add > s - add:
		break
	add += l[i]
	c += 1
print(c)


import os
import sys
from io import BytesIO, IOBase

def main():
	pass
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')
n = int(input())
coins = input().split(' ')
sum = 0
for i in range(n):
	sum += int(coins[i])
SortedCoins = sorted(coins, key=int, reverse=True)
MyCoins = 0
c = 0
while MyCoins <= int(sum / 2):
	MyCoins += int(SortedCoins[c])
	c += 1
print(c)


def main():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	sum = 0
	for i in range(n):
		sum += a[i]
	ans = 0
	rans = 0
	for i in range(n - 1, -1, -1):
		ans += a[i]
		if ans > sum - ans:
			break
		rans += 1
	print(rans + 1, end='\n')
main()


n = int(input())
a = list(map(int, input().split()))[:n]
a.sort()
sum = 0
for i in range(len(a)):
	sum = sum + a[i]
mid = sum // 2
temp = 1
one = a[n - 1]
for i in range(n - 1, 0, -1):
	if mid >= one:
		temp += 1
		one = one + a[i - 1]
print(temp)


n = int(input())
array = sorted(list(map(int, input().split())))
count = 0
half = sum(array) // 2
_sum = 0
for index in range(n - 1, -1, -1):
	_sum += array[index]
	count += 1
	if _sum > half:
		break
print(count)


input()
coins = list(map(int, input().split()))
coins.sort(reverse=True)
half = sum(coins) / 2
wallet = 0
num = 0
while wallet <= half:
	wallet += coins[num]
	num += 1
print(num)


n = int(input())
coins = sorted(list(map(int, input().split())))
Sum = sum(coins)
have = 0
cnt = 0
for i in range(n - 1, -1, -1):
	have += coins[i]
	cnt += 1
	if Sum // 2 < have:
		break
print(cnt)


n = input()
c = list(map(int, input().split()))
c.sort(reverse=True)
a = b = 0
while a <= sum(c) / 2:
	a += c[b]
	b += 1
print(b)


a = int(input())
b = list(map(int, input().split()))
c = sum(b) / 2
s = 0
j = 0
for i in b:
	if s <= c and a > 0:
		s = s + max(b)
		b.insert(b.index(max(b)), 0)
		b.pop(b.index(max(b)))
		j = j + 1
	else:
		break
print(j)


n = int(input())
a = list(map(int, str(input()).split()))
a.sort()
summ = 0
count = 0
while 1:
	count += 1
	temp = a.pop()
	summ += temp
	if sum(a) < summ:
		break
print(count)


j = 0
a = int(input())
b = [int(x) for x in input().split()]
b.sort(reverse=True)
if len(b) == a:
	(c, d) = (0, sum(b))
	for i in b:
		if c <= d:
			c = c + i
			d = d - i
			j = j + 1
		else:
			break
print(j)


def mayor(lista):
	mayor = int(lista[0])
	pos = 0
	for k in range(len(lista)):
		if int(lista[k]) > mayor:
			mayor = int(lista[k])
			pos = k
	return (mayor, pos)

def Decreciente(lista):
	orden = []
	for i in range(len(lista)):
		(elemento, posicion) = mayor(lista)
		orden.append(elemento)
		lista2 = []
		for k in range(len(lista)):
			if int(k) != posicion:
				lista2.append(lista[k])
		lista = lista2
	return orden
n = int(input())
c = input()
c = c.split()
lista = Decreciente(c)
suma = 0
suma2 = 0
m = 0
for k in range(n):
	suma += int(lista[k])
for k in range(n):
	suma2 += int(lista[k])
	m += 1
	if suma2 > suma - suma2:
		break
print(m)


n = input()
a = input()
a = a.split()
sum = 0
thr = 0
b = []
for i in a:
	sum += int(i)
	b.append(int(i))
b.sort(reverse=True)
i = 0
while thr <= sum / 2:
	thr += int(b[i])
	i = i + 1
print(i)


n = int(input())
coins = input().split()
sum_coins = 0
for i in range(n):
	coins[i] = int(coins[i])
	sum_coins += coins[i]
coins.sort(reverse=True)
i = 0
sum_temp = 0
while sum_temp <= sum_coins / 2 and i < n:
	sum_temp += coins[i]
	i += 1
print(i)


x = int(input())
n = list(map(int, input().split()))
l = sorted(n, reverse=True)
s = 0
s1 = 0
x1 = 0
for i in range(len(l)):
	s += l[i]
for i in range(len(l)):
	s1 += l[i]
	x1 += 1
	if s1 > s / 2:
		break
print(x1)


n = int(input())
inp = input().split()
arr = []
s = 0
for i in range(len(inp)):
	arr.append(int(inp[i]))
	s = s + arr[i]
arr.sort(reverse=True)
csum = 0
for i in range(len(arr)):
	s = s - arr[i]
	csum = csum + arr[i]
	if csum > s:
		print(i + 1)
		break


(_, coins) = (input(), list(map(int, str(input()).split(' '))))
startLen = len(coins)
myCoins = 0
coins.sort()
while sum(coins) >= myCoins:
	myCoins += coins.pop()
print(startLen - len(coins))


(n, arr) = (int(input()), list(map(int, input().split())))
arr.sort(reverse=True)
s = list()
for i in arr:
	s.append(i)
	if sum(s) > sum(arr) / 2:
		break
print(len(s))


n = int(input())
coins = input().split()
for i in range(len(coins)):
	coins[i] = int(coins[i])
A = max(coins)
coins.pop(coins.index(A))
num = 1
while A <= sum(coins):
	A += max(coins)
	coins.pop(coins.index(max(coins)))
	num += 1
print(num)


n = int(input())
arr = sorted(list(map(int, input().split())))
a = sum(arr) // 2
b = 0
coins = 0
while b <= a:
	b = b + arr[n - 1]
	n = n - 1
	coins = coins + 1
print(coins)


def coinsCount():
	n = int(input())
	coins = input()
	coins = coins.split(' ')
	intCoin = []
	for coin in coins:
		intCoin.append(int(coin))
	intCoin = sorted(intCoin, reverse=True)
	i = 0
	while i in range(n):
		if sum(intCoin[0:i + 1]) > sum(intCoin[i + 1:n]):
			print(str(i + 1))
			return
		else:
			i += 1
coinsCount()


n = int(input())
c = list(map(int, input().split()))
k = sum(c)
c.sort(reverse=True)
pp = 0
cnt = 0
while pp < k / 2 + 1e-07:
	pp += c[0]
	c = c[1:]
	cnt += 1
print(cnt)


n = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
i = 0
sum1 = 0
sum2 = 0
count = 0
while sum1 <= sum2:
	sum1 += arr[i]
	count += 1
	sum2 = 0
	for j in range(i + 1, n):
		sum2 += arr[j]
	i += 1
print(count)


n = int(input())
tk = sorted(map(int, input().split()))
value = int(sum(tk) / 2)
c = 0
v = 0
i = n - 1
while i >= 0:
	c += 1
	v += tk[i]
	if v > value:
		break
	else:
		i += -1
		continue
	i += -1
print(c)


n = int(input())
l = input().split()
l = [int(i) for i in l]
sum = sum(l)
l.sort(reverse=True)
steal = 0
count = 0
for n in l:
	steal += n
	count += 1
	if steal > sum / 2:
		break
print(count)


num = input()
nums = [int(x) for x in input().split()]

def solve(num, nums):
	if not num or not nums:
		return 0
	_sum = 0
	nums = sorted(nums)
	total = sum(nums)
	res = 0
	for i in range(len(nums) - 1, -1, -1):
		if _sum > total / 2:
			break
		_sum += nums[i]
		res += 1
	return res
print(solve(num, nums))


n = int(input())
coin_value = list(map(int, input().split()))
min_coin = 0
sum_coin = 0
for i in sorted(coin_value, reverse=True):
	sum_coin += i
	min_coin += 1
	if sum_coin > sum(coin_value) / 2:
		break
print(min_coin)


def sortN(numbers):
	if len(numbers) == 1 or len(numbers) == 0:
		return numbers
	num = numbers[0]
	left = []
	mid = []
	right = []
	for i in numbers:
		if i == num:
			mid.append(i)
		elif i < num:
			left.append(i)
		else:
			right.append(i)
	return sortN(left) + mid + sortN(right)
n = int(input())
money = [int(x) for x in input().split(' ')]
sum = sum(money)
our = 0
money = sortN(money)
counter = 0
while sum >= our:
	el = money[-counter - 1]
	our += el
	sum -= el
	counter += 1
print(counter)


input()
coin = list(map(int, input().split()))
coin.sort()
half = sum(coin) / 2
a = 0
b = 0
while a <= half:
	a += coin[-1]
	b += 1
	coin.pop(-1)
print(b)


n = int(input())
a = list(input().split(' '))
d = 0
s = 0
tem = 0
counter = 0
for i in range(n):
	s = s + int(a[i])
s = s / 1.9999
a = sorted(a, key=int, reverse=True)
for i in range(n):
	if tem < s:
		tem = tem + int(a[i])
		counter += 1
	else:
		break
if counter < 1:
	print(1)
else:
	print(counter)


n = int(input())
candy = sorted(list(map(int, input().split(' '))))
sumc = sum(candy)
count = 0
last = n - 1
flag = 0
suma = 0
while last >= 0 and flag == 0:
	suma += candy[last]
	last -= 1
	count += 1
	if suma > sumc // 2:
		flag = 1
print(count)


n = int(input())
coins = sorted(list(map(int, input().split())))
myCoins = []
for i in range(n - 1, -1, -1):
	myCoins = coins[i:]
	ourCoins = coins[0:i]
	if sum(myCoins) > sum(ourCoins):
		print(len(myCoins))
		break


n = int(input())
a = list(map(int, input().split()))
a1 = []
a2 = a
count = 0
while sum(a1) <= sum(a2):
	a1.append(max(a2))
	a2.remove(max(a2))
	count = count + 1
print(count)


n = int(input())
L = [int(x) for x in input().split()]
L.sort()
i = n - 1
test = False
while i >= 0 and test == False:
	test = sum(L[:i]) < sum(L[i:])
	i -= 1
print(len(L[i + 1:]))


n = int(input())
arr = [int(i) for i in input().split()]
arr.sort(reverse=True)
s = sum(arr)
m = [0, 0]
for i in range(n):
	m[0] += arr[i]
	s -= arr[i]
	m[1] += 1
	if m[0] > s:
		break
print(m[1])


def solve(coins):
	total = count = 0
	goal = sum(coins) / 2
	while total <= goal:
		total += coins.pop(coins.index(max(coins)))
		count += 1
	print(count)
n = int(input())
coins = [int(x) for x in input().split()]
solve(coins)


n = int(input())
a = input().split()
a = list(map(int, a))
a.sort(reverse=True)
su = 0
for i in range(n):
	su += int(a[i])
(s, ans) = (0, 0)
for i in range(n):
	s += int(a[i])
	ans += 1
	if s > su - s:
		break
print(ans)


n = input()
a = input().split()
s = 0
for i in range(len(a)):
	a[i] = int(a[i])
s = sum(a)
a.sort()
a = sorted(a)
a.reverse()
m = s // 2 + 1
o = []
i = 0
while sum(o) < m:
	o.append(a[i])
	i = i + 1
print(len(o))


n = int(input())
c = input().split()
b1 = 0
a = 0
c = list(map(lambda x: int(x), c))
c.sort(reverse=True)
for i in range(n):
	if b1 <= sum(c[i:n]):
		b1 += c[i]
		a += 1
	else:
		break
print(a)


input()
l = [int(x) for x in input().split()]
l.sort(reverse=True)
s = sum(l) / 2
s2 = 0
k = 0
for x in l:
	s2 += x
	k += 1
	if s2 > s:
		print(k)
		exit()


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


n = int(input())
coins = list(map(int, input().split()))
coins = sorted(coins)[::-1]
my_sum = 0
twin_sum = sum(coins)
lenght = 0
for i in range(n):
	my_sum += coins[i]
	twin_sum -= coins[i]
	lenght += 1
	if my_sum > twin_sum:
		print(lenght)
		break


print((lambda a: list(map(lambda x: sum(a[:x + 1]) > sum(a[x + 1:]), range(len(a)))).index(True) + 1)([int(input())] * 0 + list(sorted([int(i) for i in input().split()], key=lambda x: -x))))


n = int(input())
L = []
L += input().split()
somme = 0
for item in L:
	somme += int(item)

def maxi(L):
	mx = int(L[0])
	for item in L:
		if int(item) >= mx:
			mx = int(item)
	return mx
i = 0
a = 0
while a <= somme // 2:
	a += int(maxi(L))
	L.remove(str(maxi(L)))
	i += 1
print(i)


from math import ceil
a = int(input())
input_list = sorted([int(x) for x in input().split()])
b_sum_half = sum(input_list) / 2
greedy_list = []
greedy_counter = 0
for i in range(a):
	greedy_list.append(input_list.pop())
	greedy_counter += 1
	if sum(greedy_list) > b_sum_half:
		print(greedy_counter)
		break


input()
coins = list(input().split(' '))
coins = [int(c) for c in coins]
coins = sorted(coins)
coins = coins[::-1]
sumB = sum(coins)
sumA = 0
i = 0
while sumA <= sumB:
	sumA += coins[i]
	sumB -= coins[i]
	i += 1
print(i)


coinNum = int(input())
coins = input().split(' ')
for i in range(coinNum):
	coins[i] = int(coins[i])
coins.sort(reverse=True)
coinsTaken = 0

def coinTheif(aList):
	global coinsTaken
	ctValue = 0
	ntValue = 0
	for i in range(len(aList)):
		ntValue += aList[i]
	while ctValue <= ntValue:
		popped = aList.pop(0)
		ctValue += popped
		ntValue -= popped
		coinsTaken += 1
coinTheif(coins)
print(coinsTaken)


t = int(input())
a = [int(x) for x in input().split()]
s = int(sum(a) / 2) + 1
a = sorted(a)
a = a[::-1]
c = 0
k = 0
for i in range(t):
	if k + a[i] >= s:
		c += 1
		break
	else:
		k = k + a[i]
		c += 1
print(c)


numberOfCoins = int(input())
coins = sorted([int(i) for i in input().split(' ')], reverse=True)
for (i, coin) in enumerate(coins, start=1):
	if sum(coins[:i]) > sum(coins[i:]):
		print(i)
		break


n = int(input())
l = [int(n) for n in input().split()]
l.sort(reverse=True)
u = 0
t = 0
a = sum(l)
for i in range(n):
	u += l[i]
	if u * 2 > a:
		break
	else:
		t += 1
print(t + 1)


n = int(input())
a = list(map(int, input().split()))
c = 0
ind = 0
count = 0
a.sort(reverse=True)
for i in a:
	if c <= sum(a):
		c += i
		a[ind] = 0
		ind += 1
	if c > sum(a):
		break
print(ind)


n = int(input())
tSum = 0
lis = input().split()
for i in range(n):
	lis[i] = int(lis[i])
lis.sort()
for i in range(n):
	tSum += int(lis[i])
sum1 = 0
nCoins = 0
tSum = tSum / 2
while sum1 <= tSum:
	nCoins += 1
	sum1 += int(lis[n - nCoins])
print(nCoins)


numberOfCoins = int(input())
coins = input().split()
coins.sort(key=int)
minNeededCoins = 0
myMoney = 0
for i in range(numberOfCoins):
	myMoney += int(coins.pop())
	minNeededCoins += 1
	if myMoney > sum((int(element) for element in coins)):
		print(minNeededCoins)
		break


n = int(input())
lst = list(map(int, input().split()))
lst.sort()
for i in range(n - 1, -1, -1):
	(s, t) = (0, 0)
	for j in range(n - 1, i - 1, -1):
		s += lst[j]
	for j in range(i):
		t += lst[j]
	if s > t:
		print(n - i)
		break


import math

def ans(arr, n):
	arr.sort()
	ele = sum(arr) // 2
	count = 0
	current = 0
	for i in range(len(arr) - 1, -1, -1):
		if current > ele:
			return count
		count += 1
		current += arr[i]
	return count

def search(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] is x:
			ans = mid
			l = mid + 1
		elif arr[mid] > x:
			ans = mid
			r = mid - 1
		else:
			l = mid + 1
	return ans
n = int(input())
arr = list(map(int, input().strip().split(' ')))
print(ans(arr, n))


n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
t = sum(a) / 2
f = a[0]
i = 1
while f <= t:
	f += a[i]
	i += 1
print(i)


n = int(input())
a = [int(i) for i in input().split()]
values = [0]
coins = 0
a.sort(reverse=True)
while sum(values) <= sum(a):
	values.append(a[0])
	del a[0]
	coins += 1
print(coins)


n = int(input())
p = list(input().split())
p2 = []
for i in p:
	k = int(i)
	p2.append(k)
p2.sort(reverse=True)
sum = 0
for m in p2:
	sum += m
x = sum / 2
num = 0
for j in range(n):
	num += p2[j]
	if num > x:
		print(j + 1)
		break


n_coin = int(input())
t_sum = 0
coin_val = [int(x) for x in input().split()]
for x in coin_val:
	t_sum += x
coin_val.sort(reverse=True)

class AGS:

	def __init__(self):
		self.min = 9999
		self.flag = False

	def min_coin_fun(self, coin_val, min_coin1, curr_val, rem_val, ind):
		while not self.flag:
			if curr_val > rem_val:
				if min_coin1 < self.min:
					self.min = min_coin1
				self.flag = True
				return
			if ind > len(coin_val) - 1:
				return
			else:
				for i in range(1, 3):
					if i == 2:
						self.min_coin_fun(coin_val, min_coin1, curr_val, rem_val, ind + 1)
					elif i == 1:
						self.min_coin_fun(coin_val, min_coin1 + 1, curr_val + coin_val[ind], rem_val - coin_val[ind], ind + 1)
ags_obj = AGS()
ags_obj.min_coin_fun(coin_val, 0, 0, t_sum, 0)
print(ags_obj.min)


input()
a = list(map(int, input().split(' ')))
sum1 = sum(a) // 2
a.sort(reverse=True)
b = 0
cnt = 0
for x in a:
	b += x
	cnt += 1
	if b > sum1:
		break
print(cnt)


n = int(input())
arr = list(map(int, input().split()))
arr = sorted(arr, reverse=True)
half = sum(arr) // 2
me = 0
count = 0
for i in range(n):
	me += arr[i]
	count += 1
	if me > half:
		print(count)
		break


n = int(input())
c = [int(i) for i in input().split()]
c = sorted(c)
prefix = [0] * n
prefix[0] = c[0]
for i in range(1, n):
	prefix[i] = prefix[i - 1] + c[i]
coins = []
i = -1
while True:
	i += 1
	t1 = prefix[i]
	t2 = prefix[n - 1] - prefix[i]
	if t1 > t2:
		break
	elif t2 > t1:
		coins.append(n - (i + 1))
if len(c) == 2 and c[0] == c[1]:
	print(2)
elif len(c) == 1:
	print(1)
else:
	print(min(coins))


n = int(input())
c = sorted(map(int, input().split()), reverse=True)
s = sum(c)
for i in range(len(c)):
	s2 = sum(c[:i + 1])
	if s2 > s - s2:
		print(i + 1)
		break


x = int(input())
l = list(map(int, input().split()))
l.sort()
l2 = l[::-1]
temp = 0
count = 0
i = 0
for i in range(len(l2)):
	temp += l2[i]
	if temp > sum(l2) - temp:
		break
	else:
		count += 1
print(count + 1)


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


n = int(input())
x = list(map(int, input().split()))
x.sort()
mine = 0
for i in range(n):
	mine += x[-i - 1]
	if mine > sum(x) / 2:
		print(i + 1)
		break


n = int(input())
l = [int(x) for x in input().split()]
l.sort(reverse=True)
s = sum(l)
for i in range(0, n):
	sa = sum(l[:i + 1])
	if sa > s - sa:
		print(i + 1)
		break


n = int(input())
li = [int(x) for x in input().split()]
sum_of_coins = sum(li)
li.sort(reverse=True)
i = 0
larger_sum = 0
while i < n:
	larger_sum += li[i]
	if larger_sum > sum_of_coins - larger_sum:
		break
	i += 1
print(i + 1)


N = int(input())
coins = [int(i) for i in input().split()]
coins.sort()
myCoinsNumber = 0
myCoinsValue = 0
while myCoinsValue <= sum(coins):
	myCoinsNumber += 1
	myCoinsValue += coins[-1]
	coins.pop()
print(myCoinsNumber)


n = int(input())
a = 0
coins = [int(x) for x in input().split()]
coins.sort(reverse=True)
b = sum(coins) / 2
for i in range(n):
	a += coins[i]
	if a > b:
		print(i + 1)
		break


n = int(input())
arr = input().split()
sum = 0
for i in range(0, len(arr)):
	arr[i] = int(arr[i])
	sum += arr[i]
arr.sort(reverse=True)
ans = 0
count = 0
for i in arr:
	if count <= sum / 2:
		ans += 1
		count += i
	else:
		break
print(ans)


def rearrangement(a):
	out = []
	count = 0
	for item in a:
		item = int(item)
		a[count] = item
		count = count + 1
	for i in range(0, count):
		d = max(a)
		out.append(d)
		a.remove(d)
	return out
number = int(input(''))
coins = str(input('')).split()
for i in (0, number - 1):
	coins[i] = int(coins[i])
coins = rearrangement(coins)
totalmoney = 0
for coin in coins:
	totalmoney = totalmoney + coin
coinnumber = 0
mymoney = float(0)
while mymoney <= totalmoney / 2:
	mymoney = mymoney + coins[0]
	coins.remove(coins[0])
	coinnumber = coinnumber + 1
print(coinnumber)


n = int(input())
arr = list(map(int, input().split()))
som = 0
for values in arr:
	som += values
arr.sort(reverse=True)
bhadve = 0
bh = 0
for values in arr:
	if som >= bh:
		bh = bh + values
		bhadve += 1
		som = som - values
print(bhadve)


n = int(input())
larger = 0
money = [int(x) for x in input().split()]
money.sort(reverse=True)
Total = sum(money)
for i in range(n):
	larger += money[i]
	if larger > Total / 2:
		print(i + 1)
		break


n = input()
m = list(map(int, input().split()))
m.sort()
m.reverse()
mx = sum(m)
a = 0
i = 0
while a <= mx // 2:
	a += m[i]
	i += 1
print(i)


n = int(input())
l = list(map(int, input().split()))
l.sort()
l.reverse()
sum = 0
for i in range(len(l)):
	sum += int(l[i])
part = 0
sum /= 2
count = 0
for i in range(len(l)):
	if part > sum:
		break
	else:
		part += int(l[i])
		count += 1
print(str(count))


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
total = sum(coins)
count = 0
temp_sum = 0
for i in coins:
	count += 1
	temp_sum += i
	total -= i
	if total < temp_sum:
		break
print(count)


import sys
coins = []
coinsValueTotal = 0
n = int(sys.stdin.readline())
inputs = sys.stdin.readline().split()
for i in range(len(inputs)):
	coin = int(inputs[i])
	coins.append(coin)
	coinsValueTotal += coin
coins.sort(reverse=True)
minCoins = 0
halfCoinsValueTotal = coinsValueTotal / 2
for i in range(len(coins)):
	minCoins += coins[i]
	if minCoins > halfCoinsValueTotal:
		print(i + 1)
		break


n = int(input())
a = []
a = [int(i) for i in input().split()]
su = 0
c = 0
a.sort(reverse=True)
i = 0
while i < n:
	if su <= sum(a) - su:
		su += a[i]
		c += 1
		i += 1
	else:
		break
print(c)


def twins():
	input()
	coin_list = [int(elem) for elem in input().split()]
	coin_list.sort(reverse=True)
	min_amount = 0
	num_coins = 0
	summation = sum(coin_list)
	for i in coin_list:
		min_amount += i
		num_coins += 1
		if min_amount > summation / 2:
			break
	print(num_coins)
twins()


input()
coins_input = input()
coins = [int(coin) for coin in coins_input.split(' ')]
coins_taken = 0
value_taken = 0
value_remaining = sum(coins)
while value_taken <= value_remaining:
	coin_to_take = max(coins)
	coins.remove(coin_to_take)
	coins_taken += 1
	value_taken += coin_to_take
	value_remaining -= coin_to_take
print(coins_taken)


import math as m
n = int(input())
l = [int(x) for x in input().split()]
l.sort(reverse=True)
s = sum(l)
v = m.floor(s / 2)
c = 0
count = 0
for i in range(0, len(l)):
	if v < c:
		break
	c += l[i]
	count += 1
print(count)


n = int(input())
a = [int(el) for el in input().split()]
for j in range(1, len(a)):
	key = a[j]
	i = j - 1
	while i >= 0 and key > a[i]:
		a[i + 1] = a[i]
		i -= 1
	a[i + 1] = key
for i in range(0, len(a) + 1):
	s = sum(a[:i])
	s2 = sum(a[i:len(a)])
	if s > s2:
		print(i)
		break


n = int(input())
a = list(map(int, input().split()))
x = sum(a)
a.sort()
s = 0
i = 1
w = 0
while s <= x // 2:
	w += 1
	s += a[-i]
	i += 1
print(w)


n = int(input())
s = [int(i) for i in input().split()]
s.sort(reverse=True)
x = sum(s)
z = 0
c = 0
for i in s:
	z += 1
	c += i
	if c > x - c:
		print(z)
		break


n = int(input())
lst = list(map(int, input().split()))
s = 0
c = 0
x = 0
k = 0
for i in range(1, n + 1):
	x = max(lst)
	s = s + x
	lst.remove(x)
	if s > sum(lst):
		c = i
		break
print(c)


n = int(input())
a = list(map(int, input().split()))
(b, c) = (0, 0)
for i in range(n):
	b += max(a)
	a.remove(max(a))
	c += 1
	if b > sum(a):
		print(c)
		exit()


n = int(input())
m = [int(a) for a in input().split()]
m_ = sorted(m)
x = 0
z = 0
for i in range(n):
	x += m_[-i - 1]
	z += 1
	if x > sum(m) / 2:
		print(z)
		break


n = int(input())
l = list(map(int, input().split(' ')))
l.sort()
l.reverse()
le = len(l)
c = 0
while sum(l) >= c:
	c = c + l[0]
	l.remove(l[0])
print(le - len(l))


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
s = sum(arr)
i = n - 1
count = 0
ans = 0
while i >= 0 and count <= s:
	count += arr[i]
	s -= arr[i]
	i -= 1
	ans += 1
print(ans)


n = int(input())
coins = [int(i) for i in input().split()]
total = sum(coins)
coins = sorted(coins, reverse=True)
minimum = 0
count = 0
for i in range(len(coins)):
	minimum += coins[i]
	count += 1
	if minimum > total - minimum:
		break
print(count)


from sys import stdin, stdout
n = int(stdin.readline())
arr = list(map(int, stdin.readline().split()))
arr.sort(reverse=True)
s_me = 0
count = 0
s_bthr = sum(arr)
for i in range(len(arr)):
	if s_me > s_bthr:
		break
	else:
		s_me += arr[i]
		s_bthr -= arr[i]
		count += 1
stdout.write(str(count) + '\n')


n = input()
n = int(n)
arr = list(map(int, input().rstrip().split()))
s = sum(arr)
count = 0
arr.sort()
ss = 0
for i in reversed(range(len(arr))):
	ss = ss + arr[i]
	count = count + 1
	if ss > s / 2:
		print(count)
		break


coins = int(input())
coinv = list(map(int, input().split()))
coinv = sorted(coinv)
coinv = list(reversed(coinv))
g = sum(coinv)
g = int(g / 2)
m = 0
c = 0
for i in list(coinv):
	if m <= g:
		m = m + i
		c += 1
print(c)


import math
coin_nos = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
total = sum(coins)
i = len(coins)
while True:
	sumc = sum(coins[:i])
	if sumc > total - sumc:
		i -= 1
	else:
		print(i + 1)
		break


n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
b = []
for i in a:
	if sum(b) <= sum(a) / 2:
		b.append(i)
print(len(b))


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


n = int(input())
a = sorted([int(i) for i in input().split()], reverse=True)
if n == 1:
	print(1)
else:
	s = sum(a) // 2
	(x, i) = (0, 0)
	while x <= s and i <= n // 2:
		x += a[i]
		i += 1
	if x < s:
		i += 1
	print(i)


from audioop import reverse
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
s = sum(a)
k = 0
for i in range(0, n):
	k = k + a[i]
	if k > s / 2:
		break
print(i + 1)


n = int(input())
m = 0
L = sorted(list(map(int, input().split())))
L.reverse()
x = sum(L)
for i in range(n):
	m += L[i]
	if 2 * m > x:
		print(i + 1)
		break


n = int(input())
money = list(map(int, input().split()))
brothers = 0
mymoney = 0
money.sort()
money.reverse()
a = 0
b = 0
for i in money:
	brothers += i
while mymoney <= brothers:
	a = money[0]
	money.pop(0)
	mymoney += a
	brothers -= a
	b += 1
print(b)


L = []
Ps = 0
C = 0
Sum = 0
N = input()
L = list(map(int, input().split()))
L = sorted(L, reverse=True)
for i in L:
	Sum += i
while Ps <= Sum:
	Ps += L[C]
	Sum -= L[C]
	C += 1
print(C)


def twins():
	n = int(input())
	x = list(map(int, input().split()))
	x.sort(reverse=True)
	value = sum(x) / 2
	check = x.pop(0)
	count = 1
	for i in x:
		if check > value:
			break
		count = count + 1
		check = check + i
	print(count)
twins()


n = int(input())
lol = [int(n) for n in input().split()]
x = sum(lol) // 2
lol.sort()
lol.reverse()
w = 0
for i in range(len(lol)):
	w += lol[i]
	if w > x:
		print(i + 1)
		break
	else:
		continue


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
tt = 0
sm = 0
for e in coins:
	tt += e
hf = tt / 2
ct = 0
for e in coins:
	sm += e
	ct += 1
	if sm > hf:
		break
print(ct)


def int_raw():
	return int(input())

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

def ints_raw():
	return list(map(int, ss_raw()))
N = int_raw()
Ns = ints_raw()
Ns.sort()
Ns.reverse()

def ans():
	halfVal = sum(Ns) / 2.0
	take = 0
	a = 0
	for n in Ns:
		take += n
		a += 1
		if take > halfVal:
			break
	return a
print(ans())


n = int(input())
coins = [int(x) for x in input().split()]
coins.sort(reverse=True)
half = sum(coins) // 2
added = 0
counter = 0
for i in coins:
	added += i
	counter += 1
	if added > half:
		print(counter)
		break


n = int(input(''))
c = list(map(int, input().split()[:n]))
c.sort()
t = sum(c)
j = n - 1
w = 0
k = c[j]
for i in range(1, n + 1):
	if k > t - k:
		w = i
		break
	else:
		k = c[j - 1] + k
		j = j - 1
print(w)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
currsum = a[0]
ans = 1
remsum = sum(a) - a[0]
for i in range(1, n // 2 + 1):
	if currsum > remsum:
		break
	currsum += a[i]
	remsum -= a[i]
	ans += 1
print(ans)


def take_coins(all_coins):
	coins = list(map(int, all_coins.split()))
	cp_coins = [c for c in coins]
	bag = []
	for i in coins:
		if sum(bag) > sum(coins) / 2:
			break
		else:
			bigger = max(cp_coins)
			bag.append(bigger)
			cp_coins.remove(bigger)
	return len(bag)

def main():
	int(input())
	coins = input()
	my_number_of_coins = take_coins(coins)
	print(my_number_of_coins)
main()


n = int(input())
x = list(map(int, input().split()))
x = sorted(x)
c = [0, x[0]]
for i in range(1, len(x)):
	c.append(c[-1] + x[i])
s = 0
for i in range(-1, -len(x) - 1, -1):
	s = s + x[i]
	if s > c[i - 1]:
		print(-i)
		break


n = int(input())
s = input().split()
s = [int(x) for x in s]
sum = 0
for i in range(n):
	sum = sum + s[i]
s = sorted(s)
s = s[::-1]
tot = 0
c = 0
sum = sum / 2
for i in range(n):
	if s[i] + tot <= sum:
		tot = tot + s[i]
		c = c + 1
	else:
		print(c + 1)
		break


n = input()
str1 = input()
numbers = list(map(int, str1.split()))
numbers.sort()
sum1 = 0
sum2 = 0
m = 0
for i in numbers:
	sum1 = sum1 + i
while sum1 > sum2 or sum1 == sum2:
	sum1 = sum1 - numbers[len(numbers) - 1 - m]
	sum2 = sum2 + numbers[len(numbers) - 1 - m]
	m = m + 1
print(m)


n = input()
l = list(map(int, input().split()))
l.sort(reverse=True)
mine = 0
count = 0
if n == '1':
	print(1)
elif n == '2' and l[0] == l[1]:
	print(2)
else:
	for i in range(len(l) - 1):
		count += 1
		mine += l[i]
		your = sum(l[i + 1:])
		if mine > your:
			break
	print(count)


n = int(input())
lists = sorted(list(map(int, input().rstrip().split())), reverse=True)
total_sum = 0
count = 0
for i in range(len(lists)):
	total_sum += lists[i]
	count += 1
	if i != len(lists) - 1 and total_sum > sum(lists[i + 1:]):
		break
print(count)


n = int(input())
x = input().split()
for i in range(n):
	j = 0
	while j < n - 1:
		if int(x[j]) < int(x[j + 1]):
			(x[j], x[j + 1]) = (x[j + 1], x[j])
		j = j + 1
a = 0
b = sum((int(x[i]) for i in range(n)))
for i in range(n):
	a = a + int(x[i])
	if a * 2 > b:
		print(i + 1)
		break


a = int(input())
n = list(map(int, input().split()))
b = []
m = max(n)
b.append(m)
n.remove(m)
count = 1
if sum(n) < m:
	print(1)
elif sum(n) == m:
	print(2)
else:
	while sum(b) <= sum(n):
		m = max(n)
		b.append(m)
		n.remove(m)
		count = count + 1
	print(count)


n = int(input())
coins = [int(x) for x in input().split()]
coins.sort(reverse=True)
mine = []
for i in coins:
	mine.append(i)
	if sum(mine) > sum(coins) / 2:
		break
print(len(mine))


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


n = int(input())
v = sorted(list(map(int, input().split())))[::-1]
cnt = 0
sm = 0
tm = 0
for i in range(n):
	sm = tm + v[i]
	if sm > sum(v[i + 1:]):
		cnt += 1
		break
	else:
		tm = sm
		cnt += 1
print(cnt)


input()
a = input()
a = a.split(' ')
sum = 0
mycoins = 0
for k in range(0, len(a)):
	a[k] = int(a[k])
n = len(a)
for i in range(0, len(a)):
	for j in range(i, len(a)):
		if a[i] < a[j]:
			temp = a[i]
			a[i] = a[j]
			a[j] = temp
if n == 1:
	mycoins = 1
for t in range(1, n):
	for s in range(t, n):
		sum += a[s]
	if n == 2 and a[0] == a[1]:
		mycoins = 2
		break
	elif a[0] > sum:
		mycoins += 1
		break
	else:
		mycoins += 1
		a[0] += a[t]
		sum = 0
print(mycoins)


n = int(input())
l = list(map(int, input().strip().split(' ')))
l1 = []
count = 0
for i in sorted(l, reverse=True):
	l.remove(i)
	l1.append(i)
	count = count + 1
	if sum(l1) > sum(l):
		print(count)
		break


from sys import stdin, stdout
n = int(stdin.readline())
arr = sorted(list(map(int, stdin.readline().strip().split())), reverse=True)
i = 0
c = 0
while True:
	if sum(arr[0:i]) > sum(arr[i:]):
		break
	else:
		i += 1
	c += 1
print(c)


n = int(input())
a = list(map(int, input().split()))
ans = sum(a) // 2
a.sort()
res = 0
lol = 0
for i in a[::-1]:
	res += i
	lol += 1
	if res > ans:
		break
print(lol)


ii = lambda : int(input())
get = lambda : list(map(int, input().split()))
n = ii()
l = get()
l.sort(reverse=True)
i = 0
s = sum(l)
while i < n - 1:
	if l[i] > s / 2:
		break
	l[i + 1] += l[i]
	i += 1
print(i + 1)


n = int(input())
coins = list(reversed(sorted(map(int, input().split()))))
half = int(sum(coins) / 2)
a = 0
for i in range(0, n):
	a += coins[i]
	if a > half:
		print(i + 1)
		exit()


n = int(input())
a = sorted(list(map(int, input().split())))
b = s = 0
while b <= sum(a):
	b += a.pop()
	s += 1
print(s)


def main():
	n = int(input())
	sum_arr = [0] * n
	arr = list(map(int, input().split()))
	arr = sorted(arr)
	s = 0
	k = 0
	for i in arr:
		s += i
		sum_arr[k] = s
		k += 1
	s = 0
	coin_taken = 0
	for i in range(n - 1, 0, -1):
		s += arr[i]
		if s <= sum_arr[i - 1]:
			coin_taken += 1
		else:
			coin_taken += 1
			break
	else:
		if s <= sum_arr[0]:
			coin_taken += 1
	print(coin_taken)
main()


n = int(input())
arr = list(map(int, input().split()))
arr2 = []
i = 0
while sum(arr2) <= sum(arr):
	j = max(arr)
	arr2.append(j)
	arr.remove(j)
	i += 1
print(i)


def main():
	n = int(input())
	kovanice = list(map(int, input().split()))
	kovanice.sort(reverse=True)
	prefiks = [kovanice[0]]
	for i in range(1, n):
		prefiks.append(kovanice[i] + prefiks[-1])
	zbroj = 0
	broj_kovanica = 0
	for i in range(len(kovanice)):
		zbroj += kovanice[i]
		broj_kovanica += 1
		if zbroj > prefiks[n - 1] - prefiks[i]:
			print(broj_kovanica)
			exit(0)
main()


input()
c = sorted(list(map(int, input().split())))[::-1]
s = sum(c)
cur = 0
for i in range(len(c)):
	cur += c[i]
	if s / 2 < cur:
		print(i + 1)
		break


def greedySoln():
	numberOfCoins = int(input(''))
	myList = []
	coinValue = input('').split(' ')
	for i in range(len(coinValue)):
		coinValue[i] = int(coinValue[i])
	coinValue = sorted(coinValue)
	for i in range(len(coinValue)):
		myList.append(max(coinValue))
		coinValue.pop(coinValue.index(max(coinValue)))
		if sum(myList) > sum(coinValue):
			print(len(myList))
			break
greedySoln()


from sys import stdin
stdin.readline()
coins = [int(x) for x in stdin.readline().strip().split()]
coins.sort()
(total, other, i) = (sum(coins), 0, 0)
while i < len(coins) + 1 and other + coins[i] << 1 < total:
	(other, i) = (other + coins[i], i + 1)
print(len(coins) - i)


n = int(input())
v = list(map(int, input().split()))
total = sum(v)
v.sort(reverse=True)
coin = 0
coin_value = 0
while not coin_value > total // 2:
	coin_value += v[coin]
	coin += 1
print(coin)


n = int(input())
a = []
b = []
sum = 0
sum1 = 0
k = 0
a = input().split()
for i in range(n):
	b.append(int(a[i]))
b.sort()
for i in range(n):
	sum += int(a[i])
t = sum / 2 * 1.0
for i in range(n - 1, -1, -1):
	sum1 += int(b[i])
	k = k + 1
	if sum1 > t:
		break
print(k)


n = int(input())
a = []
t = 0
y = 0
symm = 0
s = list(map(int, input().split()))
for i in range(len(s)):
	a.append(int(s[i]))
a.sort(reverse=True)
for i in range(n):
	symm = 0
	t += a[i]
	y += 1
	for r in range(i + 1, n):
		symm += a[r]
	if t > symm:
		break
print(y)


n = int(input())
coins = [int(s) for s in input().split()]
coins.sort(reverse=True)
SUM = 0
flag = False
if n == 1:
	print('1')
	flag = True
for i in range(n):
	SUM += coins[i]
c = 0
sum2 = 0
for i in range(n):
	if sum2 > SUM // 2:
		sum2 += coins[i]
		print(c)
		flag = True
		break
	else:
		sum2 += coins[i]
		c += 1
if flag == False:
	print(c)


import sys, os.path
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
sys.setrecursionlimit(10 ** 5)

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

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

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

def solve():
	a = ii()
	l = sorted(li())
	l.reverse()
	y = z = c = 0
	for x in l:
		z += x
	while y <= z:
		y += l[0]
		z -= l[0]
		l.remove(l[0])
		c += 1
	print(c)
solve()


n = input()
a = list(map(int, list(input().split())))
a.sort()
a = a[::-1]
num = 0
total = 0
summ = sum(a)
for i in a:
	num += 1
	total += i
	if total > summ - total:
		print(num)
		exit()


def codeforces():
	n = int(input())
	lst = list(map(int, input().split()))
	nn = float(sum(lst) / 2)
	res = 0
	count = 0
	while res <= nn:
		res += max(lst)
		count += 1
		index = lst.index(max(lst))
		lst[index] = -1
	return count
print(codeforces())


import fractions, sys
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
s = sum(a)
(res, t) = (0, 0)
for x in a:
	t += x
	res += 1
	if t > s - t:
		break
print(res)


n = input()
a = sorted(map(int, input().split(' ')), reverse=True)
l = len(a)
tot = sum(a)
number = int(1)
for i in range(l):
	if sum(a[0:i]) <= tot / 2:
		number = i + 1
print(number)


PočetMinci = int(input())
Sučet = 0
mince = list(map(int, input().split()))
o = 0
for i in range(len(mince)):
	Sučet += mince[i]
NajvačšiaMinca = 0
MojeMince = 0
vysledok = 0
while MojeMince <= Sučet / 2:
	for i in range(PočetMinci - o):
		if mince[i] > NajvačšiaMinca:
			NajvačšiaMinca = mince[i]
			pozicia = i
	MojeMince += NajvačšiaMinca
	vysledok += 1
	mince.remove(mince[pozicia])
	o += 1
	NajvačšiaMinca = 0
print(vysledok)


n = input()
a = 101 * [0]
s = 0
l = 0
k = 0
m = input().split()
for i in m:
	a[int(i)] += 1
for i in m:
	s += int(i)
for i in range(1, 101):
	if l > s / 2:
		break
	while a[101 - i] > 0:
		a[101 - i] -= 1
		l += 101 - i
		k += 1
		if l > s / 2:
			print(k)
			break


n = int(input())
a = list(map(int, input().split()))
ans = 0
sum1 = 0
i = 0
while True:
	m = max(a)
	sum1 += m
	ans = ans + 1
	a.remove(m)
	sum2 = 0
	for x in a:
		sum2 += x
	if sum1 > sum2:
		break
print(ans)


def solve(n, arr):
	if n == 1:
		return 1
	arr.sort()
	s = sum(arr) // 2
	count = 0
	for i in range(n - 1, -1, -1):
		if s >= 0:
			count += 1
			s -= arr[i]
	return count
n = int(input())
arr = list(map(int, input().strip().split()))
print(solve(n, arr))


input()
value = [int(i) for i in input().split()]
value.sort()
avg = sum(value) / 2
ans = 0
moneygot = 0
while value and moneygot <= avg:
	ans += 1
	moneygot += value[-1]
	value.pop()
print(ans)


n = int(input())
A = input()
B = []
C = []
count = 0
S = 0
for i in A.split():
	B.append(int(i))
Sum = sum(B)
B.sort(reverse=True)
for j in range(0, n):
	S = S + B[j]
	if S > Sum / 2:
		count = j + 1
		break
print(count)


import sys

def main():
	sys.stdin.readline()
	money = list(map(int, sys.stdin.readline().split()))
	money.sort(reverse=True)
	ans = []
	if len(money) > 2:
		for i in range(len(money)):
			ans.append(money[i])
			if sum(ans) > sum(money[i + 1:]):
				break
		sys.stdout.write(f'{len(ans)}')
	elif len(money) == 1:
		sys.stdout.write('1')
	elif money[0] == money[1]:
		sys.stdout.write('2')
	else:
		sys.stdout.write('1')
main()


n = int(input())
coin = input().split()
coins = list()
for item in coin:
	coins.append(int(item))
coins.sort(reverse=True)
t = 0
answer = 0
while t <= n:
	glory = sum(coins[0:t])
	total = sum(coins)
	bright = total - glory
	if glory <= bright:
		t = t + 1
	elif glory > bright:
		break
print(t)


n = int(input())
k = [int(i) for i in input().split()]
s = len(k)
ss = 0
sss = 0
for i in range(s):
	ss += k[i]
ave = ss / 2
newk = sorted(k)
num = 0
k = 0
for j in range(s - 1, -1, -1):
	sss += newk[j]
	k += 1
	if sss > ave:
		num = k
		break
print(num)


n = int(input())
coins = [int(value) for value in input().split()]
coins.sort()
money = coins.pop()
count = 1
while coins:
	if money > sum(coins):
		break
	else:
		money += coins.pop()
		count += 1
print(count)


n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
m = sum(l) // 2
i = n - 1
s = 0
c = 0
while i >= 0:
	s += l[i]
	i -= 1
	c += 1
	if s > m:
		break
print(c)


x = int(input())
coins = list(map(int, input().split(' ')))
total_coins = len(coins)
coins = sorted(coins, reverse=True)
my_coins = coins[0]
count = 1
j = 1
sum = 0
for i in range(total_coins):
	sum += coins[i]
gap = sum - my_coins
if total_coins > 1:
	while my_coins <= gap:
		my_coins += coins[j]
		gap -= coins[j]
		count += 1
		j += 1
print(count)


input_no_of_coins = int(input())
value_coins = sorted([int(x) for x in input().split()])
s = 0
c = 0
counter = 0
for i in value_coins:
	s += i
for i in value_coins[::-1]:
	c += i
	counter += 1
	if c > s / 2:
		break
print(counter)


n = input()
coins = [int(el) for el in input().split()]
count_coins = 0
money_twin = 0
half_money = sum(coins) / 2
while money_twin <= half_money:
	money_twin += coins.pop(coins.index(max(coins)))
	count_coins += 1
print(count_coins)


n = int(input())
l = list(map(int, input().split()))
s = sum(l) // 2
l.sort()
(s2, cnt) = (0, 0)
for i in reversed(l):
	s2 += i
	cnt += 1
	if s2 > s:
		break
print(cnt)


n = input()
list_coin = input().split(' ')
int_list_coin = []
total_sum = 0
coutn_coin = 0
for elem in list_coin:
	total_sum = total_sum + int(elem)
	int_list_coin.append(int(elem))
half_sum = total_sum / 2
sum_coin = 0
int_list_coin.sort(reverse=1)
for elem in int_list_coin:
	if sum_coin <= half_sum:
		coutn_coin = coutn_coin + 1
		sum_coin = sum_coin + elem
print(coutn_coin)


n = int(input())
coins = list((int(x) for x in input().split()))
total = stolen = i = 0
for coin in coins:
	total += coin
coins.sort(reverse=True)
for coin in coins:
	stolen += coin
	i += 1
	if stolen > 0.5 * total:
		print(i)
		exit()


n = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
max = min = 0
for i in arr:
	max = max + i
	min = min + 1
	if max >= sum(arr) // 2 + 1:
		break
print(min)


n = int(input())
x = input().split()
(A, t) = (0, 0)
for i in range(n):
	x[i] = int(x[i])
	A = A + x[i]
for i in range(n):
	for j in range(i, n):
		if x[i] < x[j]:
			a = x[i]
			x[i] = x[j]
			x[j] = a
for i in range(n):
	t = t + x[i]
	if t > A - t:
		print(i + 1)
		break


n = input()
coins = input()
coins = list(map(int, coins.split(' ')))
coins = sorted(coins, reverse=True)
my_amount = 0
brother_amount = sum(coins)
number_of_coins = 0
i = 0
while my_amount <= brother_amount and i < len(coins):
	coin = coins[i]
	my_amount += coin
	brother_amount -= coin
	i += 1
print(i)


n = int(input())
arr = [int(x) for x in input().split()]
arr.sort(reverse=True)
total = sum(arr)
cnt = 0
curr = 0
i = 0
while curr <= total / 2 and i < n:
	cnt += 1
	curr += arr[i]
	i += 1
print(cnt)


input()
a = list(map(int, input().split()))
a.sort()
a.reverse()
b = sum(a)
c = 0
i = 0
while i < len(a) and c <= b:
	c += a[i]
	b -= a[i]
	i += 1
print(i)


def take_coins(num_coins: int, coins: list) -> int:
	coins = sorted(coins, reverse=True)
	half_sum_coins = sum(coins) // 2
	my_sum_coins = 0
	i = 0
	while my_sum_coins <= half_sum_coins:
		my_sum_coins += coins[i]
		i += 1
	return i
(n, a) = (int(input()), list((int(i) for i in input().split())))
print(take_coins(n, a))


n = int(input())
l = [int(x) for x in input().split()]
(mine, his) = (0, 0)
k = 0
for i in range(n):
	if mine <= sum(l):
		mine = mine + max(l)
		k = k + 1
		l.remove(max(l))
print(k)


from math import *
n = int(input())
cv = list(map(int, input().split(' ')))
(sum, c, m, m1) = (0, 0, 0, 0)
for i in range(len(cv)):
	m = max(cv)
	m1 += m
	cv.remove(m)
	for i in range(len(cv)):
		sum += cv[i]
	if m1 > sum:
		c += 1
		break
	c += 1
	sum = 0
print(c)


n = int(input())
data = sorted([int(x) for x in input().split()], reverse=True)
i = 0
while i < len(data) and sum(data[:i + 1]) <= sum(data[i + 1:]):
	i += 1
if i == len(data):
	print(len(data))
else:
	print(i + 1)


x = int(input())
z = list(map(int, input().split()))
z.sort()
z.reverse()
c = 0
x = 1
v = 0
for i in range(len(z)):
	v = v + z[i]
	for j in z[i + 1:]:
		c = c + j
	if v > c:
		break
	else:
		x = x + 1
		c = 0
print(x)


n = int(input())
coins = list(map(int, input().split(' ')))
coins.sort()
coins.reverse()
total = sum(coins)
addition = 0
count = 0
for single in coins:
	addition += single
	count += 1
	if addition > total - addition:
		break
print(count)


num = input()
num = int(num)
coins = input().split()
coins = [int(i) for i in coins]
coins.sort(reverse=True)
sum = 0
for i in range(num):
	sum += coins[i]
partial = 0
for j in range(num):
	partial += coins[j]
	if partial * 2 > sum:
		print(j + 1)
		break


ncoins = int(input())
coin_value = []
coin_value = list(map(int, input().split()))
sum1 = 0
sum2 = 0
count = 0
for i in range(0, ncoins):
	sum1 += coin_value[i]
list.sort(coin_value)
for i in range(ncoins - 1, -1, -1):
	if sum2 > sum1 / 2:
		break
	else:
		count += 1
		sum2 += coin_value[i]
print(count)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
for i in range(n):
	if i == n - 1:
		print(n)
	elif sum(a[:i + 1]) > sum(a[i + 1:]):
		print(i + 1)
		break


n = int(input())
a = [int(i) for i in input().split()]
count = 0
dsum = 0
csum = 0
if len(a) == 1:
	print(1)
	exit(0)
while dsum <= csum:
	d = max(a)
	dsum = dsum + d
	a.remove(d)
	count = count + 1
	csum = sum(a)
	if dsum > csum:
		print(count)
		exit(0)


import sys
withFile = 0
if withFile == 1:
	fin = open('input.txt', 'r')
	fout = open('output.txt', 'w')

def getl():
	if withFile == 0:
		return input()
	else:
		return fin.readline()

def printl(s):
	if withFile == 0:
		print(s)
	else:
		fout.write(str(s))

def get_arr():
	x = getl().split(' ')
	if x[-1] == '':
		x = x[:-1]
	return list(map(int, x))
n = get_arr()[0]
a = get_arr()
if n == 1:
	print(1)
	sys.exit(0)
x = int(sum(a) / 2) + 1
f = [10 ** 6 for i in range(11000)]
f[0] = 0
for i in range(n):
	for j in range(10 ** 4, -1, -1):
		if f[j] != 10 ** 6:
			f[j + a[i]] = min(f[j + a[i]], f[j] + 1)
printl(min(f[x:]))
if withFile == 1:
	fin.close()
	fout.close()


n = int(input())
a = list(map(int, input().split()))
left = 0
right = 0
coins = 0
b = sorted(a, reverse=True)
for i in b:
	left += i
for i in b:
	if right > left:
		break
	else:
		right += i
		left -= i
		coins += 1
print(coins)


def StrToInt(list_entry):
	map_object = map(int, list_entry)
	return list(map_object)

def IntToStr(list_entry):
	map_object = map(str, list_entry)
	return list(map_object)
num_entrada = int(input())
numeros = StrToInt(input().split(' '))
numeros.sort(reverse=True)
soma = sum(numeros)
metade = soma / 2
count = 0
aux_soma = 0
while count <= num_entrada and aux_soma <= metade:
	count += 1
	aux_soma += numeros.pop(0)
print(count)


num = int(input())
coins = list(map(int, input().split(' ')))
coins.sort(reverse=True)
i = 0
sumCoin = 0
while sumCoin <= sum(coins) // 2:
	sumCoin += coins[i]
	i += 1
print(i)


x = input()
n = input().split()
n = [int(i) for i in n]
n.sort()
Sum = 0
for i in n:
	Sum += i
half = Sum / 2
sum2 = 0
mine = 0
while sum2 <= half:
	sum2 += int(n[-1])
	n = n[:len(n) - 1]
	mine += 1
print(mine)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = 0
x = 0
i = 0
while n >= 0:
	if ans > sum(a):
		print(x)
		break
	else:
		ans += a[i]
		del a[i]
		x += 1
		n = n - 1


N = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
total = sum(arr)
twinTotal = 0
for i in range(N):
	twinTotal += arr[i]
	if twinTotal > total - twinTotal:
		break
print(i + 1)


n = int(input())
l = list(map(int, input().split()))
S = 0
S1 = 100000
k = 0
f = 0
l = sorted(l)
l.reverse()
while S <= S1:
	S1 = 0
	for i in range(f, n):
		S1 = S1 + l[i]
	if S1 >= S:
		S = S + l[f]
		f = f + 1
		k = k + 1
print(k)


import math
n = int(input())
a = input().split()
summ = 0
my_sum = 0
for i in range(n):
	a[i] = int(a[i])
	summ += a[i]
a.sort()
i = 1
summ = summ // 2
while my_sum <= summ:
	my_sum += a[n - i]
	i += 1
print(i - 1)


t = int(input())
x = 0
y = 0
t = 0
l = list(map(int, input().split()))
l.sort()
l.reverse()
for i in l:
	x += i
for i in l:
	t += 1
	y += i
	if y > int(x / 2):
		print(t)
		break


num = int(input())
sum = 0
sum1 = 0
count = 0
coi = list(map(int, input().split()))
coi.sort(reverse=True)
for i in range(len(coi)):
	sum += coi[i]
for i in range(len(coi)):
	if sum1 > sum / 2:
		break
	sum1 += coi[i]
	count += 1
print(count)


n = int(input())
coins = [int(i) for i in input().split()]
coins.sort()
coins.reverse()
s = sum(coins) / 2
o = 0
p = 0
for i in coins:
	if p <= s:
		p += i
		o += 1
print(o)


n = int(input())
list = [int(x) for x in input().split()]
coins = sorted(list, reverse=True)
average = sum(coins) / 2
mycoins = 0
for i in range(n):
	mycoins += coins[i]
	if mycoins > average:
		break
print(i + 1)


def insertion_sort(array):
	for i in range(1, len(array)):
		element = array[i]
		j = i - 1
		while j >= 0 and element < array[j]:
			array[j + 1] = array[j]
			j = j - 1
		array[j + 1] = element

def number_coins(n, coins):
	sum_coins = sum(coins)
	insertion_sort(coins)
	my_coins = 0
	number = 0
	for i in range(len(coins) - 1, -1, -1):
		my_coins += coins[i]
		number += 1
		sum_coins -= coins[i]
		if my_coins > sum_coins:
			return number
	return number
n = int(input())
coins = input().split()
coins = list(map(int, coins))
print(number_coins(n, coins))


def sum(a):
	sum = 0
	for i in a:
		sum += i
	return sum
n = input()
a = list(map(int, input().split()))
a.sort()
a.reverse()
s = sum(a)
s1 = 0
c = 0
for i in range(len(a)):
	if s1 > s:
		break
	s1 += a[i]
	s -= a[i]
	c += 1
print(c)


N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
me = 0
twi = sum(A)
ans = 0
for a in A:
	if me > twi:
		break
	me += a
	twi -= a
	ans += 1
print(ans)


n = int(input())
l = [int(x) for x in input().split()]
l.sort(reverse=True)
p = sum(l)
k = 0
for i in range(len(l)):
	k += l[i]
	if k > p / 2:
		m = i
		break
print(m + 1)


masukan1 = int(input())
masukan2 = input()
masukanl = []
batas = 0
for i in masukan2.split():
	batas = batas + int(i)
	masukanl = masukanl + [int(i)]
batas = batas / 2
masukanl.sort(reverse=True)
x = 0
output = 0
for i in masukanl:
	if x > batas:
		break
	x = x + i
	output = output + 1
print(output)


number = int(input())
value = input()
value = value.split(' ')
valuelist = []
for i in value:
	valuelist.append(int(i))
valuelist.sort()
get = []
for i in range(len(valuelist) - 1, -1, -1):
	if sum(get) <= sum(valuelist[:i + 1]):
		get.append(int(valuelist[i]))
	else:
		break
print(len(get))


n = int(input())
list1 = [int(x) for x in input().split()]
list1.sort()
list1.reverse()
sum = 0
for i in range(n):
	sum = sum + list1[i]
a = 0
list2 = []
for i in range(n):
	a = a + list1[i]
	if a > sum - a:
		list2.append(i)
print(list2[0] + 1)


i = int(input())
coins = str(input()).split()
coins = list(map(int, coins))
coins.sort(reverse=True)
total_sum = sum(coins)
twin_sum = total_sum
my_sum = 0
for (key, el) in enumerate(coins):
	my_sum += el
	twin_sum -= el
	if my_sum > twin_sum:
		print(key + 1)
		break


def qsort(inlist):
	if inlist == []:
		return []
	else:
		pivot = inlist[0]
		lesser = qsort([x for x in inlist[1:] if x < pivot])
		greater = qsort([x for x in inlist[1:] if x >= pivot])
		return lesser + [pivot] + greater
n = int(input())
arr = list(map(int, input().split()))
arr = qsort(arr)
sum1 = 0
sum2 = sum(arr)
for i in range(n):
	sum1 += arr[n - 1 - i]
	sum2 -= arr[n - 1 - i]
	if sum1 > sum2:
		break
print(i + 1)


st = input()
n = eval(st)
st = input()
nums = st.split(' ')
num = [int] * n
sum = 0
for i in range(0, n):
	num[i] = eval(nums[i])
	sum = sum + num[i]
for i in range(0, n - 1):
	for j in range(0, n - i - 1):
		if num[j] < num[j + 1]:
			tmp = num[j]
			num[j] = num[j + 1]
			num[j + 1] = tmp
count = 0
i = 0
while count * 2 <= sum and i < n:
	count = count + num[i]
	i = i + 1
print(i)


n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
(i, c) = (0, 0)
total = 0
tsum = sum(a)
while i < n and total <= tsum:
	if total <= tsum:
		total += a[i]
		c += 1
		tsum -= a[i]
	i += 1
print(c)


s = int(input())
r = list(map(int, input().split()))
count = 1
w = max(r)
r.remove(w)
while w <= sum(r):
	t = max(r)
	w += t
	r.remove(t)
	count += 1
print(count)


n = int(input())
l = input().split()
s = 0
k = 0
import sys
for i in range(n):
	l[i] = int(l[i])
	s = s + l[i]
l = sorted(l)
l.reverse()
for m in range(0, n):
	k = k + int(l[m])
	if k > s / 2:
		print(m + 1)
		sys.exit()


nr_coins = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
total = sum(coins)
take_nr = 0
take_sum = 0
for it in coins:
	take_nr += 1
	take_sum += it
	brother_sum = total - take_sum
	if take_sum > brother_sum:
		break
print(take_nr)


t = int(input())
arr = list(map(int, input().split()))
count = 1
arr.sort(reverse=True)
suu = 0
o = sum(arr)
for i in arr:
	suu += i
	if suu > o - suu:
		print(count)
		break
	else:
		count += 1


import sys
import math
n = int(input())
coins = [int(x) for x in input().split()]
coins.sort(reverse=True)
minimum_coin = 0
for i in range(len(coins)):
	minimum_coin += 1
	if sum(coins[:i + 1]) > sum(coins[i + 1:]):
		print(minimum_coin)
		sys.exit()
print(minimum_coin)


n = int(input())
a = list(map(int, input().split()))
a.sort()
count = 0
while count <= sum(a):
	count = count + a[-1]
	del a[-1]
print(n - len(a))


input()
arr = [x for x in map(int, input().split(' '))]
count = 0
total = 0
arr.sort(reverse=True)
for (ind, val) in enumerate(arr):
	total += val
	count += 1
	if total > sum(arr[ind + 1:]):
		break
print(count)


loop = int(input())
inputLine = input()
coinList = inputLine.split(' ')
s = 0
for i in range(0, loop):
	s += int(coinList[i])
coin = 0
amount = 0
while amount <= s / 2:
	high = 0
	for j in range(0, len(coinList)):
		temp = int(coinList[j])
		if temp > high:
			high = temp
	amount += high
	coin += 1
	coinList.remove(str(high))
print(coin)


n = input()
coins = sorted([int(s) for s in input().split(' ')])
target = sum(coins) / 2
i = -1
take = 0
while take <= target:
	take += coins[i]
	i -= 1
print(-i - 1)


def solve():
	num_coins = int(input())
	vals = [int(x) for x in input().split()]
	vals.sort(reverse=True)
	init_sum = sum(vals)
	curr = 0
	for i in range(len(vals)):
		curr += vals[i]
		if curr > init_sum - curr:
			print(i + 1)
			return
solve()


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = 0
cur = 0
for i in a:
	cur += i
	ans += 1
	if cur > sum(a[ans:]):
		print(ans)
		exit(0)


n = int(input())
a = list(map(int, input().split()))
a.sort()
b = 0
k = 0
i = n - 1
while i > -1:
	b = b + a[i]
	k = k + 1
	if b > sum(a) // 2:
		break
	i = i - 1
print(k)


n = int(input())
arr = [int(i) for i in input().split()]
su = sum(arr)
arr.sort(reverse=True)
su1 = 0
for i in range(n):
	su1 += arr[i]
	if su1 > su - su1:
		print(i + 1)
		break


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


n = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse=True)
total = sum(a)
x = 0
i = 0
while i < n:
	x += a[i]
	if 2 * x <= total:
		i += 1
	else:
		break
print(i + 1)


n = int(input())
N = [int(i) for i in input().split()]
N.sort(reverse=True)
s = 0
S = []
for i in range(n):
	s += N[i]
	S.append(s)
for i in range(n):
	if S[i] > sum(N) / 2:
		print(i + 1)
		break
	else:
		continue


n = int(input())
coins = [int(x) for x in input().split()]
sorted_coins = sorted(coins, reverse=True)
total = sum(coins)
cur_sum = 0
coin_count = 0
half = total / 2
for c in sorted_coins:
	cur_sum += c
	coin_count += 1
	if cur_sum > half:
		print(coin_count)
		break


n = int(input())
l = list(map(int, input().split()))
getting_max_coin = max(l)
l.pop(l.index(getting_max_coin))
counter = 1
total_values = getting_max_coin
for i in range(n - 1):
	if sum(l) < total_values:
		break
	total_values += max(l)
	l.pop(l.index(max(l)))
	counter += 1
print(counter)


from itertools import combinations

def twins(list):
	s = 0
	count = 0
	list = sorted(list, reverse=True)
	mid = sum(list) / 2
	for i in list:
		s += i
		count += 1
		if s > mid:
			break
	print(count)
n = int(input())
list = [int(x) for x in input().split()]
twins(list)


n = int(input())
s = [int(x) for x in input().split()]
s.sort(reverse=True)
pol = sum(s) // 2
i = 0
summa = 0
while summa <= pol:
	summa += s[i]
	i += 1
print(i)


n = int(input())
twin1 = [int(i) for i in input().split()]
twin2 = []
count = 0
twin1 = sorted(twin1)
while sum(twin1) >= sum(twin2):
	twin2.append(twin1[-1])
	twin1 = twin1[:len(twin1) - 1]
	count += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
sum_a = sum(a) // 2
a.sort(reverse=True)
k = 0
i = 0
while i < n:
	k += a[i]
	if k > sum_a:
		print(i + 1)
		break
	i += 1


a = int(input())
b = input()
c = b.split()
d = []
sum = 0
for i in c:
	d.append(int(i))
	sum += int(i)
d.sort(reverse=True)
count = 0
cou = 0
for h in d:
	count += h
	cou += 1
	if count > sum / 2:
		break
print(cou)


import functools
n = int(input())
coins = [int(x) for x in input().split()]
coins.sort()
coins = coins[::-1]
sum = functools.reduce(lambda x, y: x + y, coins, 0)
taken_sum = 0
result = 0
for c in coins:
	result += 1
	taken_sum += c
	sum -= c
	if taken_sum > sum:
		break
print(result)


n = int(input())
a = [int(x) for x in input().split()]
s1 = sum(a)
s2 = int(s1 / 2) + 1
a.sort(reverse=True)
count = 0
s3 = 0
for i in a:
	if s3 >= s2:
		break
	s3 += i
	count += 1
print(count)


n = int(input())
a = map(int, input().split())
a = sorted(a)
tsum = sum(a)
sumk = c = 0
while sumk <= tsum / 2:
	sumk += a.pop()
	c += 1
print(c)


(n, a, k1, k2, i) = (int(input()), [int(s) for s in input().split()], 0, 0, 0)
while k1 <= sum(a):
	i = a.index(max(a))
	k1 += a[i]
	k2 += 1
	a.pop(i)
print(k2)


def main():
	n = int(input())
	a = [int(i) for i in input().split()]
	if n == 1:
		print(n)
		return
	a.sort(reverse=True)
	for i in range(1, n):
		b = sum(a[0:i])
		c = sum(a[i:])
		if b > c:
			print(i)
			return
	if i == n - 1:
		print(n)
main()


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


n = int(input())
lis = list(map(int, input().split()))
lis.sort(reverse=True)
s = 0
for i in range(0, n):
	s = s + lis[i]
m = 0
j = 0
while j < n:
	m = m + lis[j]
	if 2 * m > s:
		break
	j = j + 1
print(j + 1)


n = int(input())
if n > 1:
	a = sorted(map(int, input().split()), reverse=True)
	s = sum(a)
	my = 0
	ans = 0
	for e in a:
		if my <= s / 2:
			my += e
			ans += 1
	print(ans)
else:
	input()
	print(1)


from math import ceil

def solve(n, a):
	a.sort(reverse=True)
	s = sum(a)
	x = s // 2 + 1 if s % 2 == 0 else ceil(s / 2)
	s = 0
	for (i, v) in enumerate(a):
		s += v
		if s >= x:
			return i + 1

def main():
	n = int(input())
	a = list(map(int, input().split()))
	print(solve(n, a))
main()


b = int(input())
a = list(map(int, input().split()))
my = 0
r = 0
to = sum(a)
a.sort()
a.reverse()
i = -1
y = True
while y:
	i += 1
	r += 1
	my += a[i]
	if my > to - my:
		y = False
print(r)


input()
my = []
his = list(map(int, input().split()))
his.sort()
while sum(my) <= sum(his):
	my.append(his.pop())
print(len(my))


n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
sum = 0
kolm = 0
sum2 = 0
for i in a:
	sum += i
sum = sum // 2
for i in a:
	kolm += 1
	sum2 += i
	if sum2 > sum:
		break
print(kolm)


index = 0
indexes = []
sorted_array = []
total = 0
coin = 0
coin_sum = 0
coin_count = int(input())
coins = input().split()
for i in range(len(coins)):
	coins[i] = int(coins[i])
for j in range(len(coins)):
	minimum = max(coins) + 1
	for i in range(len(coins)):
		if minimum >= coins[i] and i not in indexes:
			minimum = coins[i]
			index = i
	indexes.append(index)
	sorted_array.append(minimum)
for i in sorted_array:
	total += i
for i in range(len(sorted_array) - 1, -1, -1):
	coin += 1
	coin_sum += int(sorted_array[i])
	if coin_sum > total / 2:
		break
print(coin)


n = int(input())
a = list(map(int, input().split()))
b = []
i = 1
while i <= n:
	num = max(a)
	b.append(num)
	a.remove(num)
	if sum(b) > sum(a):
		print(i)
		break
	else:
		i += 1


CoinNo = int(input())
Coins = sorted([int(x) for x in input().split()])
CoinSum = sum(Coins)
total = 0
count = 0
for y in range(CoinNo):
	total += Coins[CoinNo - 1 - y]
	count += 1
	if total > CoinSum // 2:
		break
print(count)


def su(m):
	sum = 0
	for i in m:
		sum += i
	return sum
n = int(input())
s = input()
t = list(map(int, s.split()))
t.sort(reverse=True)
ct = 0
c = 0
for i in range(len(t)):
	x = t[i + 1:]
	c += t[i]
	ct += 1
	if c > su(x):
		print(ct)
		break


n = int(input())
a = [int(i) for i in input().split()]
Max = []
while sum(Max) <= sum(a):
	Max.append(max(a))
	a.remove(max(a))
print(len(Max))


n = int(input())
str = input().split(' ')
arr = []
if n == 1:
	print(1)
	quit()
for i in range(0, n):
	arr.append(int(str[i]))
arr.sort()
ff = []
fl = []
prev = 0
for i in arr:
	prev = prev + i
	ff.append(prev)
arr.sort(reverse=True)
prev = 0
for i in arr:
	prev = prev + i
	fl.append(prev)
for i in range(0, n):
	if ff[n - i - 2] < fl[i]:
		print(i + 1)
		quit()
print(n)


coins = int(input())
values = sorted([int(i) for i in input().split()])
minimum = sum(values) / 2
Total = 0
for i in range(coins):
	Total += values[coins - i - 1]
	if Total > minimum:
		i += 1
		break
print(i)


x = input()
inp = sorted(list(map(int, input().split())))
if len(inp) == 1:
	print(1)
else:
	s = 0
	rem = sum(inp)
	i = 1
	while s <= rem and len(inp) - i != -1:
		s += inp[len(inp) - i]
		rem -= inp[len(inp) - i]
		i += 1
	print(i - 1)


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
(k, flag, total) = (0, 0, 0)
for i in range(n):
	k = k + l[i]
k = k / 2
while total <= k:
	total = total + l[n - 1]
	n = n - 1
	flag = flag + 1
print(flag)


__author__ = 'widoc'
n = int(input())
d = list(map(int, input().split()))
s = sum(d)
s = s // 2
res = 0
d.sort(reverse=True)
for i in range(n):
	res += d[i]
	if res > s:
		print(i + 1)
		break


n = int(input())
l = sorted([int(i) for i in input().split()])
ans = 0
k = 0
while ans <= sum(l):
	ans += l.pop()
	k += 1
print(k)


num = input()
lis = sorted([int(item) for item in input().split()], reverse=True)
k = 0
i = 0
for i in range(len(lis)):
	k += lis[i]
	i += 1
	if k > sum(lis) / 2:
		break
print(i)


input()
coinlen = 0
coinsum = 0
coins = sorted([int(x) for x in input().split()])
half = sum(coins) / 2
if len(coins) == 1:
	coinlen = 1
for i in range(len(coins)):
	if coins[i] > half:
		coinlen = 1
		coinsum = coins[i]
	for j in range(i + 1, len(coins)):
		s = coins[i:j + 1]
		if (len(s) < coinlen or coinlen == 0) and sum(s) > half:
			coinlen = len(s)
			coinsum = sum(s)
print(coinlen)


N = int(input())
sum2 = 0
count = 0
n = [int(x) for x in input().split()]
sum1 = sum(n) / 2
n.sort(reverse=True)
for i in range(len(n)):
	sum2 = sum2 + n[i]
	if sum2 > sum1:
		print(i + 1)
		break


n = int(input())
a = list(map(int, input().split()))
a.sort()
z = sum(a)
c = 0
s = 0
for j in range(len(a) - 1, -1, -1):
	if s <= z // 2:
		s = s + a[j]
		c = c + 1
	else:
		break
print(c)


a = input()
xs = [int(x) for x in input().split()]
c = sum(xs)
xs.sort(reverse=True)
b = 0
for i in range(int(a)):
	b += xs[i]
	if b > c / 2:
		break
print(i + 1)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
s = sum(a)
t = 0
i = 0
while t <= s:
	t += a[i]
	s -= a[i]
	i += 1
print(i)


n_nums = int(input())
nums = list(map(lambda x: int(x), input().split(' ')))
nums = sorted(nums, reverse=True)
total = sum(nums)
cur_sum = 0
counter = 0
for num in nums:
	cur_sum += num
	counter += 1
	if cur_sum > total - cur_sum:
		print(counter)
		exit()


N = int(input())
m = [int(x) for x in input().split()]
l = sorted(m, reverse=True)
sum_ = 0
for i in l:
	sum_ += i
new_sum = 0
j = 0
while sum_ / 2.0 >= new_sum:
	new_sum += l[j]
	j += 1
print(j)


z = int(input())
x = [int(x) for x in input().split()]
x.sort(reverse=True)
s = sum(x)
a = 0
count = 0
for i in x:
	a = a + i
	count += 1
	s = s - i
	if a > s:
		print(count)
		break


n = int(input())
values = sorted(map(int, input().split()))
total = 0
while total <= sum(values):
	total += values.pop()
print(n - len(values))


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
p = sum(l)
n = 0
Q = 0
for i in range(len(l)):
	n += l[i]
	if n > p / 2:
		Q = i
		break
print(Q + 1)


n = int(input())
line = [0 for i in range(0, n)]
s = input()
yv = 0
iv = 0
m = s.split()
for i in range(0, n):
	line[i] = int(m[i])
line = sorted(line)
maxx = n - 1
minn = 0
num = 0
if n == 1:
	num = 1
else:
	while n > 0:
		iv += line[maxx]
		maxx -= 1
		n -= 1
		num += 1
		while yv < iv and n > 0 and (yv + line[minn] < iv):
			yv += line[minn]
			minn += 1
			n -= 1
print(num)


n = int(input())
li = list(map(int, input().strip().split()))
c = 0
a = 0
li.sort()
for i in range(n - 1, -1, -1):
	if c > sum(li) - c:
		break
	else:
		c += li[i]
	a += 1
print(a)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
total = sum(a)
temp = 0
ans = 0
for i in range(n):
	temp += a[i]
	total -= a[i]
	if temp > total:
		ans = i + 1
		break
print(ans)


n = int(input())
l = [int(i) for i in input().split()]
count = 0
sum = sum(l)
l.sort(reverse=True)
coin = 0
for i in l:
	if coin > sum:
		break
	else:
		coin += i
		sum -= i
		count += 1
print(count)


n = int(input())
l = list(map(int, input().split()))
l.sort()
l.reverse()
S = sum(l) // 2
i = 0
Sum = 0
while Sum <= S:
	Sum = Sum + l[i]
	i = i + 1
print(i)


n = int(input())
coins = sorted(list(map(int, input().split())), reverse=True)
counter = 0
max_count = n
while n != 0:
	counter += 1
	if counter != max_count and sum(coins[:counter]) > sum(coins[counter:]):
		break
	n -= 1
print(counter)


import math
n = int(input())
count = 0
iterate = 0
arr = list(map(int, input().split()))
arr.sort(reverse=True)
Some = sum(arr)
div = Some / 2
for i in range(0, len(arr) + 1):
	if count > div:
		print(iterate)
		break
	else:
		count += arr[i]
		iterate += 1


i = int(input())
coins = sorted(list(map(int, input().split(' '))), reverse=True)
for j in range(0, i + 1):
	if sum(coins[:j]) > sum(coins[j:]):
		print(str(j))
		exit()


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
tot = sum(a)
now = 0
for i in range(len(a)):
	now += a[i]
	if now * 2 > tot:
		break
print(i + 1)


input()
l = sorted((int(x) for x in input().split()))[::-1]
s = sum(l)
cur = 0
ans = 0
while 2 * cur <= s:
	cur += l[ans]
	ans += 1
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
total = sum(a)
take = 0
coin = 0
for i in a:
	take += i
	coin += 1
	if take > total - take:
		break
print(coin)


n = int(input())
m = list(map(int, input().split()))
half = sum(m) / 2
coin = 0
value = 0
for (i, j) in enumerate(reversed(sorted(m))):
	value += j
	coin += 1
	if value > half:
		break
print(coin)


a = int(input())
b = list(map(int, input().split(' ')))
z = sorted(b, reverse=True)
k = []
for i in range(len(b)):
	k.append(z[i])
	if sum(k) > sum(z[i + 1:]):
		break
print(len(k))


def read_int():
	return int(input())

def read_ints():
	return map(int, input().split(' '))
n = read_int()
a = list(read_ints())
a.sort(reverse=True)
s = sum(a)
current = 0
for i in range(n):
	current += a[i]
	s -= a[i]
	if current > s:
		print(i + 1)
		break


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


n = int(input())
a = [int(x) for x in input().split()]
a = sorted(a, reverse=True)
m = 0
sum = 0
b = 0
for i in range(n):
	sum = sum + a[i]
sum = sum / 2
for i in range(n):
	b = b + a[i]
	if b > sum:
		print(i + 1)
		break


n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
ts = sum(a) // 2
c = 0
ds = 0
for i in a:
	ds += i
	c += 1
	if ds > ts:
		print(c)
		break


n = int(input())
coins = list(map(int, input().split(' ')))
sum_c = 0
for i in coins:
	sum_c += i
min_max = int(sum_c / 2) + 1
coins.sort(reverse=True)
count = 0
sum_c = 0
for i in coins:
	sum_c += i
	count += 1
	if sum_c >= min_max:
		break
print(count)


n = input()
s = input().split(' ')
s = [int(x) for x in s]
s.sort(reverse=True)
l = sum(s)
sum1 = 0
c = 0
for i in range(len(s)):
	sum1 += s[i]
	c += 1
	if sum1 > sum(s[i + 1:]):
		break
	else:
		continue
print(c)


c = int(input())
n = input().split(' ')
n = [int(i) for i in n]
n.sort()
n.reverse()
s = sum(n)
count = 0
countsum = 0
for i in n:
	countsum += i
	s -= i
	count += 1
	if countsum > s:
		break
print(count)


n = int(input())
a = [int(e) for e in input().split()]
a.sort()
c = a[::-1]
ts = sum(c)
s = 0
i = 0
if n == 1:
	print(1)
else:
	while i < n:
		s += c[i]
		ts -= c[i]
		if s > ts:
			break
		i += 1
	print(i + 1)


n = int(input())
l = sorted([int(i) for i in input().split()])[::-1]
s = sum(l)
t1 = 0
cnt = 1
for i in range(n):
	t1 += l[i]
	if t1 <= s - t1:
		cnt += 1
	else:
		break
print(cnt)


N = int(input())
number = input()
l = [int(x) for x in number.split()]
l.sort(reverse=True)
total = 0
coin = 0
j = 0
for i in range(0, N):
	total = total + l[i]
for i in range(0, N):
	if coin > total / 2:
		break
	else:
		coin = coin + l[i]
		j += 1
print(j)


n = int(input(''))
l = list(map(int, input().split()))
l.sort()
l.reverse()
sum1 = l[0]
sum2 = sum(l) - l[0]
for i in range(1, n + 1, 1):
	if sum1 <= sum2:
		sum1 = sum1 + l[i]
		sum2 = sum2 - l[i]
	else:
		print(i)
		break


n = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
total = sum(arr)
csum = 0
i = 0
while csum <= total / 2:
	csum += arr[i]
	i += 1
print(i)


n = int(input())
l = sorted(list(map(int, input().split())), reverse=True)
a = b = 0
while a <= sum(l) // 2:
	a += l[b]
	b += 1
print(b)


n = input()
b = input().split()
cunter = 0
csum = 0
massa = []
for i in b:
	massa.append(int(i))
d = sorted(massa, reverse=True)
for i in d:
	summ = sum(d)
	if csum <= summ:
		csum = csum + i
		cunter += 1
		d[cunter - 1] = 0
print(cunter)


a = int(input())
money = [int(i) for i in input().split()]
money.sort(reverse=True)
k = 1
for i in range(a):
	if sum(money[:i]) > sum(money[i:]) or len(money) <= 2:
		if len(money) <= 2:
			if len(money) == 2:
				if money[0] != money[1]:
					k = money.index(max(money[0], money[1])) + 1
				else:
					k = len(money)
			else:
				k = len(money)
		else:
			k = i
		break
print(k)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
tot = sum(arr)
ans = 0
cnt = 0
i = n - 1
while ans <= tot - ans and i > -1:
	ans += arr[i]
	i -= 1
	cnt += 1
print(cnt)


numberOfCoins = int(input())
coinsValues = input().split()

def addCoins(numberOfCoins):
	coins = []
	for x in range(numberOfCoins):
		number = int(coinsValues[x])
		coins.append(number)
	return coins
coins = addCoins(numberOfCoins)
coins.sort()
minNumOfCoins = 0
myCoins = 0
while True:
	myCoins += coins.pop()
	minNumOfCoins += 1
	sum = 0
	for x in range(len(coins)):
		sum += coins[x]
	if sum < myCoins:
		break
print(minNumOfCoins, end='')


n = int(input())
coin = [int(x) for x in input().split()]
hasil = 0
total = 0
a = sorted(coin)[::-1]
for i in range(len(a)):
	hasil += a[i]
	total += 1
	if hasil > sum(a[i + 1:]):
		break
print(total)


number = int(input())
coin = [int(c) for c in input().split()]
coin.sort()
(tms, suM, fTwin) = (0, sum(coin), 0)
for i in reversed(coin):
	tms += 1
	(suM, fTwin) = (suM - i, fTwin + i)
	if fTwin > suM:
		print(tms)
		break


n = int(input())
coins = list(map(int, input().strip().split()))
total_sum = sum(coins)
half_sum = total_sum / 2
running_sum = 0
num_coins = 0
for coin in sorted(coins, reverse=True):
	running_sum += coin
	num_coins += 1
	if running_sum > half_sum:
		print(num_coins)
		break


def twinCoins():
	int(input())
	l = list(map(int, input().strip().split()))
	s1 = sum(l)
	s2 = 0
	count = 0
	l.sort(reverse=True)
	for e in l:
		s2 += e
		s1 -= e
		count += 1
		if s2 > s1:
			return count
print(twinCoins())


n = int(input())
moedas = input().split()
lista = []
soma = 0
for i in moedas:
	lista.append(int(i))
	soma += int(i)
lista.sort()
metade = soma / 2
resultado = 0
for i in range(len(lista) - 1, -1, -1):
	if soma >= metade:
		resultado += 1
		soma -= lista[i]
print(resultado)


def main():
	n = int(input())
	c = [int(x) for x in input().split()]
	c.sort()
	r_sum = []
	post = 0
	for x in range(0, n):
		r_sum.append(post + c[-x - 1])
		post = r_sum[x]
	sums = r_sum[-1]
	for x in range(0, n):
		if r_sum[x] > sums - r_sum[x]:
			print(x + 1)
			break
main()


x = int(input())
s = input()
s = s.strip()
list1 = s.split(' ')
list1 = list(map(int, list1))
set = set(list1)
set = sorted(set)
set.reverse()
list2 = []
for i in set:
	for j in range(list1.count(i)):
		if sum(list1) >= sum(list2) and list1.count(i) != 0:
			list2.append(i)
			list1.remove(i)
	if sum(list1) < sum(list2):
		break
print(len(list2))


def partition(a, start=0, end=0):
	pivot = a[end]
	pi = start
	for i in range(start, end):
		if a[i] <= pivot:
			(a[i], a[pi]) = (a[pi], a[i])
			pi += 1
	(a[pi], a[end]) = (a[end], a[pi])
	return pi

def quicksort(a, start=0, end=0):
	if start < end:
		pi = partition(a, start, end)
		quicksort(a, start, pi - 1)
		quicksort(a, pi + 1, end)
n = int(input())
l = []
arr = input().split()
if n == 1:
	print('1')
else:
	for i in range(n):
		l.append(int(arr[i]))
	quicksort(l, 0, n - 1)
	twin = l[0]
	my = l[n - 1]
	if n == 2 and my > twin:
		print('1')
	elif n == 2 and my == twin:
		print('2')
	elif l.count(l[0]) == n:
		print(n // 2 + 1)
	else:
		j = n - 2
		i = 1
		coins = 1
		while i != j:
			if twin >= my:
				my += l[j]
				j -= 1
				coins += 1
			else:
				twin += l[i]
				i += 1
		if twin == my:
			coins += 1
		elif twin < my:
			twin += l[i]
			if twin >= my:
				coins += 1
		elif twin > my:
			my += l[i]
			if twin >= my:
				coins += 1
			coins += 1
		print(coins)


t = int(input())
coins = list(map(int, input().split()))
total = sum(coins)
sum = 0
coins.sort(reverse=True)
count = 0
for i in range(t):
	sum += coins[i]
	count += 1
	if sum > total - sum:
		break
print(count)


n = int(input())
coins = list(map(int, input().split()))
sm = sum(coins)
res = 0
for (i, c) in enumerate(sorted(coins, reverse=1)):
	res += c
	if res > sm - res:
		print(i + 1)
		exit(0)
print(len(coins))


n = int(input())
line = input().split()
for i in range(n):
	line[i] = int(line[i])
res = []
for i in range(len(line)):
	res.append(max(line))
	line.remove(max(line))
	if sum(res) > sum(line):
		break
print(len(res))


n = int(input())
a = list(map(int, input().strip().split(' ')))
a.sort()
x = sum(a)
t = 0
count = 0
for i in range(n - 1, -1, -1):
	t += a[i]
	count += 1
	if t > x - t:
		break
print(count)


n = int(input())
list1 = list(map(int, input().split(' ', n)[:n]))
sum1 = sum(list1)
sum2 = 0
count = 0
list1.sort()
list1.reverse()
for j in range(len(list1)):
	if sum2 > sum1 / 2:
		break
	else:
		sum2 += list1[j]
		count += 1
print(count)


input()
a = sorted(list(map(int, input().split())))
(counter, Sum, i, b) = (0, 0, len(a) - 1, sum(a))
while Sum <= b / 2:
	Sum += a[i]
	i -= 1
	counter += 1
print(counter)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
add = 0
mid = sum(a) // 2
for i in range(n):
	add += a[i]
	if add > mid:
		break
print(i + 1)


n = int(input())
l = list(map(int, input().split()))
l.sort()
take = 0
m = sum(l) // 2
out = 0
for i in range(n - 1, -1, -1):
	take += l[i]
	out += 1
	if take > m:
		break
print(out)


numberOfCoins = int(input())
coinValues = sorted(list(map(int, input().split())), reverse=True)
quantity = 0
value = 0
totalValue = sum(coinValues)
while value <= totalValue / 2:
	value += coinValues[quantity]
	quantity += 1
print(quantity)


n = input()
li = input().split(' ')
for i in range(len(li)):
	li[i] = int(li[i])
li = sorted(li)[::-1]
s = 0
counter = 0
done = False
while not done:
	s += li[counter]
	counter += 1
	if sum(li[counter:]) < s:
		done = True
print(counter)


n = int(input())
coins = input().split(' ')
coins = [int(x) for x in coins]
coins.sort()
coins.reverse()
sumTotal = 0
for coin in coins:
	sumTotal = sumTotal + int(coin)
i = 0
nCoins = 0
sumCoins = 0
while sumCoins <= sumTotal / 2:
	sumCoins = sumCoins + int(coins[i])
	nCoins = nCoins + 1
	i = i + 1
print(nCoins)


n = input()
m = input().split()
for i in range(len(m)):
	m[i] = int(m[i])
c = 1
while c < len(m):
	for i in range(len(m) - c):
		if m[i] < m[i + 1]:
			(m[i], m[i + 1]) = (m[i + 1], m[i])
	c += 1
for i in range(1, len(m) + 1):
	if sum(m[:i]) > sum(m[i:]):
		print(i)
		break


n = int(input())
c = sorted([int(x) for x in input().split()])
for i in range(n):
	if sum(c[:n - (i + 1)]) < sum(c[n - (i + 1):]):
		print(i + 1)
		break


n = input()
coins = sorted(map(int, input().split()), reverse=True)
total = sum(coins)
me = 0
cnt = 0
while me <= total - me:
	me += coins[cnt]
	cnt += 1
print(cnt)


from math import *
k = int(input())
l = list(map(int, input().split()))
i = 0
tot = 0
if sum(l) % 2 != 0:
	val = ceil(sum(l) / 2)
else:
	val = sum(l) / 2 + 1
while tot < val:
	tot += max(l)
	l.remove(max(l))
	i += 1
print(i)


n = int(input())
coins = list(map(int, input().strip().split(' ')))
sumCoins = sum(coins)
sumMy = 0
q = 0
coins.sort(reverse=True)
for i in coins:
	sumMy += i
	q += 1
	if sumMy > sumCoins - sumMy:
		break
print(q)


n = int(input())
l = [int(x) for x in input().split()]
l.sort(reverse=True)
s = 0
while l:
	s += l.pop(0)
	if s > sum(l):
		print(n - len(l))
		break


m = int(input())
(r, k) = (0, 0)
ls = list(map(int, input().split()))
ls.sort(reverse=True)
while sum(ls) >= k:
	k += ls[0]
	ls.remove(ls[0])
	r += 1
print(r)


while 1:
	try:
		n = int(input())
		x = [int(e) for e in input().split()]
	except:
		break
	x = sorted(x, reverse=True)
	p = a = b = i = 0
	while p == 0:
		a += x.pop(0)
		i += 1
		if a > sum(x):
			p = 1
	print(i)


def main():
	input()
	coins = ints_from_input()
	coins.sort(reverse=True)
	my_part = 0
	brother_part = sum(coins)
	cnt = 0
	for coin in coins:
		my_part += coin
		brother_part -= coin
		cnt += 1
		if my_part > brother_part:
			break
	return cnt

def ints_from_input():
	return [int(i) for i in input().split()]
print(main())


_ = input()
coins = sorted(list(map(int, input().split())), reverse=True)
take = 0
n_take = 0
for c in coins.copy():
	take += c
	n_take += 1
	coins.remove(c)
	if take > sum(coins):
		print(n_take)
		break


n = int(input())
a = [int(x) for x in input().strip().split(' ')]
a.sort()
N = len(a)
s = sum(a)
s1 = 0
count = 0
for i in range(N - 1, -1, -1):
	s1 += a[i]
	s -= a[i]
	if s1 > s:
		count += 1
		break
	else:
		count += 1
print(count)


num = int(input())
coins = input()
coins_list = coins.split()
coin_sum = 0
coins_to_take = 0
coins_list = [int(i) for i in coins_list]
for i in range(num):
	max_coin = max(coins_list)
	coin_sum += max_coin
	coins_list.remove(max_coin)
	coins_to_take += 1
	if coin_sum > sum(coins_list):
		break
print(coins_to_take)


n = int(input())
m = input().split()
a = []
for i in m:
	a.append(int(i))
a.sort(reverse=True)
s = sum(a)
count = 0
for i in range(n):
	count = count + a[i]
	s = s - a[i]
	if count > s:
		print(i + 1)
		break


n = int(input())
a = input().split(' ')
coins = [int(i) for i in a]
coins.sort(reverse=True)
total_sum = sum(coins)
curr_sum = 0
nr_coins = 0
for (i, c) in enumerate(coins):
	curr_sum += c
	if curr_sum > total_sum - curr_sum:
		nr_coins = i + 1
		break
print(nr_coins)


noc = int(input())
coins = list(map(int, input().split(' ')))
num = 0
coins.sort()
coins = coins[::-1]
for i in range(0, noc):
	sum1 = sum(coins[:i + 1])
	sum2 = sum(coins[i + 1:])
	if sum1 > sum2:
		num = i + 1
		break
print(num)


input()
b = list(map(int, input().split()))
b.sort(reverse=True)
c = 1
while sum(b[:c]) <= sum(b) / 2:
	c += 1
print(c)


n = int(input())
s = [int(a) for a in input().split()]
s.sort()
ss = 0
sss = 0
for a in s:
	ss += a
for i in range(len(s)):
	sss += s[len(s) - i - 1]
	if sss > ss / 2:
		break
print(i + 1)


n = int(input())
a = [int(x) for x in input().split()]
a = sorted(a)
a.reverse()
taken = 0
i = 0
while sum(a) >= taken:
	taken += a[i]
	a[i] = 0
	i += 1
print(i)


n = int(input().strip())
ins = input().strip().split(' ')
c = [int(i) for i in ins]
c.sort(reverse=True)
start = 1
me_sum = c[start - 1]
total = sum(c)
while me_sum <= total - me_sum:
	start += 1
	me_sum += c[start - 1]
print(start)


n = int(input())
a = list(map(int, input().strip().split()))
a.sort(reverse=True)
q = sum(a)
q = q // 2
w = 0
count = 0
for i in a:
	w += i
	if w > q:
		break
	count += 1
print(count + 1)


n = int(input())
l = list(map(int, input().split()))
l.sort()
s = 0
d = sum(l)
j = 0
for i in range(n - 1, -1, -1):
	s += l[i]
	d -= l[i]
	j += 1
	if s > d:
		break
print(j)


coins = input()
arr = input().split()
arr = list(map(int, arr))
arr.sort(reverse=True)
total = sum(arr)
count = 0
accumulator = 0
for i in range(0, int(coins)):
	accumulator += arr[i]
	count += 1
	if accumulator > float(total / 2.0):
		break
print(count)


n = int(input())
a = sorted(list(map(int, input().split())))[::-1]
for i in range(len(a) + 1):
	t1 = sum(a[:i])
	t2 = sum(a) - t1
	if t1 > t2:
		print(i)
		break


def main():
	n = int(input())
	coins = sorted(list(map(int, input().split())))[::-1]
	for i in range(len(coins)):
		if sum(coins[:i + 1]) > sum(coins[i + 1:]):
			print(i + 1)
			exit()
main()


n = int(input())
z = sorted(list(map(int, input().split())))
(s1, s2) = (0, z[-1])
j = -1
for i in range(n - 1):
	s1 += z[i]
while s2 <= s1:
	j += -1
	s2 += z[j]
	s1 -= z[j]
print(j * -1)


n = int(input())
data = list(map(int, input().split()))
data.sort(reverse=True)
if n > 1:
	for i in range(1, n):
		L = data[:i]
		R = data[i:]
		if sum(L) > sum(R):
			print(i)
			break
	else:
		print(n)
else:
	print(n)


size = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
counter = 0
summ = 0
i = 0
while True:
	summ += arr[i]
	counter += 1
	if summ > sum(arr[i + 1:]):
		print(counter)
		break
	else:
		i += 1


n = int(input())
coins = input().split()
for i in range(n):
	coins[i] = int(coins[i])
coins.sort(key=None, reverse=True)
sums = sum(coins)
temp = 0
for i in range(n):
	temp += coins[i]
	if 2 * temp > sums:
		print(i + 1)
		break


n = int(input())
value_of_coins = list(map(int, input().split()))
count = 1
for i in range(n - 1):
	for j in range(n - i - 1):
		if value_of_coins[j] < value_of_coins[j + 1]:
			(value_of_coins[j], value_of_coins[j + 1]) = (value_of_coins[j + 1], value_of_coins[j])
total_sum = value_of_coins[0]
for i in range(n - 1):
	total_sum = total_sum + value_of_coins[i + 1]
total_sum = total_sum / 2
total_sum = int(total_sum)
sum_of_stolen_coins = value_of_coins[0]
for i in range(n - 1):
	if sum_of_stolen_coins > total_sum:
		break
	else:
		sum_of_stolen_coins = sum_of_stolen_coins + value_of_coins[i + 1]
		count = count + 1
print(count)


num = int(input())
a = input().split(' ')
coin_list = []
for i in range(num):
	coin_list.append(int(a[i]))
coin_list.sort(reverse=True)
total = 0
sub = 0
for i in range(num):
	sub += int(coin_list[i])
count = 0
while total <= sub - total:
	total += int(coin_list[count])
	count += 1
print(count)


def read_tokens():
	return input().strip().split(' ')

def read_ints():
	return [int(s) for s in read_tokens()]
(n,) = read_ints()
arr = read_ints()

def solve(arr: list) -> int:
	arr.sort(reverse=True)
	total_sum = sum(arr)
	left = 0
	for i in range(n):
		left += arr[i]
		right = total_sum - left
		if left > right:
			return i + 1
print(solve(arr))


n = int(input())
a = sorted([int(x) for x in input().split()])
s = sum(a)
p = 0
c = 0
for y in reversed(a):
	p += y
	s -= y
	c += 1
	if p > s:
		break
print(c)


x = int(input())
y = [int(y) for y in input().split()]
y.sort(reverse=True)
s = 0
for i in range(x):
	s = s + y[i]
sum = 0
count = 0
for i in range(x):
	sum = sum + y[i]
	count = count + 1
	if sum > s // 2:
		break
print(count)


a = int(input())
b = input().split()
s1 = 0
s = 0
c = 0
for i in b:
	b = [int(i) for i in b]
	b.sort()
	b = b[::-1]
for i in b:
	s += i
for i in b:
	s1 += i
	s -= i
	c += 1
	if s1 > s:
		print(c)
		break


a = int(input())
b = list(map(int, input().split()))
b.sort()
c = 0
d = 0
while c < a:
	d += b[c]
	c += 1
e = d / 2
f = 0
while d >= e:
	f += 1
	d -= b[c - 1]
	c -= 1
print(f)


def get_values():
	n = int(input())
	coins = list(map(int, input().split()))
	if n != len(coins):
		return
	coins = list(reversed(sorted(coins)))
	half = sum(coins) // 2
	counter = 0
	value = 0
	for i in coins:
		if value <= half:
			counter += 1
			value += i
	return print(counter)
get_values()


quantity_of_coins = int(input())
coins = [int(a) for a in input().split()]
coins.sort()
summary_right = 0
summary_left = 0
answer = 0
for r in range(-1, -(quantity_of_coins + 1), -1):
	summary_left = 0
	summary_right += coins[r]
	answer += 1
	for l in range(-quantity_of_coins, r):
		summary_left += coins[l]
	if summary_right > summary_left:
		print(answer)
		break


no_of_coins = int(input())
sequence = sorted(list(map(int, input().split())))
extra = 0
while sum(sequence[:extra + 1]) < sum(sequence[extra + 1:]):
	extra += 1
print(no_of_coins - extra)


int(input())
l = list(map(int, input().split()))
s1 = sum(l)
s2 = 0
count = 0
l.sort(reverse=True)
for i in l:
	s2 += i
	s1 -= i
	count += 1
	if s2 > s1:
		print(count)
		break


n = int(input())
arr = sorted((int(i) for i in input().split()), reverse=True)
for i in range(1, n + 1):
	if sum(arr[:i]) > sum(arr[i:]):
		print(i)
		exit()


n = int(input())
coins = input().split()
avg = 0
s = 0
number = 0
for i in range(len(coins)):
	coins[i] = int(coins[i])
	avg += coins[i]
avg = avg // 2 + 1
for i in range(n):
	if s >= avg:
		break
	s = s + max(coins)
	coins.remove(max(coins))
	number += 1
print(number)


n = int(input())
coin = [int(x) for x in input().split()]
coin.sort()
for i in range(n - 1, -1, -1):
	if sum(coin[i:]) > sum(coin[:i]):
		print(n - i)
		break


import sys
import math

def eprint(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)
tt = 1
for test in range(tt):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	arr.sort(reverse=True)
	sum = 0
	for i in arr:
		sum += i
	sum //= 2
	temp = 0
	counter = 0
	for i in arr:
		temp += i
		counter += 1
		if temp > sum:
			break
	print(counter)


n = int(input())
a = sorted(map(int, input().split()), reverse=True)
s = sum(a) // 2
r = 0
for i in range(n):
	r += a[i]
	if r > s:
		break
print(i + 1)


n = int(input())
a = [int(_) for _ in input().split()]
a.sort()
x = sum(a)
y = 0
cnt = 0
for aa in a[::-1]:
	y += aa
	x -= aa
	cnt += 1
	if y > x:
		print(cnt)
		break


n_coins = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
my_coins = []
for i in range(n_coins):
	if sum(my_coins) > sum(coins) - sum(my_coins):
		break
	my_coins.append(coins[i])
print(len(my_coins))


n = int(input())
s = list(map(int, input().split()))
a = s.copy()
s.sort(reverse=True)
ans = 0
the_sum = 0
for x in s:
	the_sum += x
	a.remove(x)
	ans += 1
	if the_sum > sum(a):
		break
print(ans)


count = int(input())
numbers = list(map(int, input().split(' ')))
numbers.sort(reverse=True)
sum = sum(numbers)
sumTwin = int('0')
cnt = int('0')
for i in numbers:
	if sumTwin > sum / 2:
		break
	else:
		cnt += 1
		sumTwin += i
print(cnt)


m = int(input())
s = list(map(int, input().split()))
s.sort()
sum1 = sum(s)
sum2 = 0
cnt = 0
for _ in range(m):
	p = s.pop()
	sum2 += p
	sum1 -= p
	cnt += 1
	if sum2 > sum1:
		print(cnt)
		break


from sys import stdin
l = [x.rstrip() for x in stdin.readlines()][1]
c = sorted(list(map(int, l.split())), reverse=True)
s = sum(c) / 2.0
for (i, x) in enumerate(c):
	s -= x
	if s < 0:
		break
print(i + 1)


num = int(input())
l = input().split()
l.sort(key=int, reverse=True)
ssum = 0
for i in range(len(l)):
	ssum += int(l[i])
sum = 0
for _ in range(len(l)):
	sum += int(l[_])
	if sum > ssum / 2:
		print(int(_) + 1)
		break


s = int(input())
de = list(map(int, input().split()))
de.sort()
(w, d, q) = (0, 0, 0)
for i in de:
	w = w + i
for k in reversed(de):
	d = d + k
	q = q + 1
	if d > w // 2:
		break
print(q)


a = int(input())
m = list(map(int, input().split()))
m = sorted(m, reverse=True)
s = sum(m)
p = 0
for i in range(a):
	p += m[i]
	if p > s / 2:
		print(i + 1)
		break


from math import *
n = int(input())
a = list(map(int, input().split()))
a.sort()
for i in range(n):
	if sum(a[:i]) < sum(a[i:]):
		ans = n - i
print(ans)


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
k = 1
a = sum(l) - l[n - 1]
b = l[n - 1]
j = n - 2
while b <= a:
	a = a - l[j]
	b = b + l[j]
	k = k + 1
	j = j - 1
print(k)


from sys import stdin, stdout, exit as sys_ret
(f_input, f_print, f_flush) = (stdin.readline, stdout.write, stdout.flush)
amount = int(f_input())
coins = sorted([int(_) for _ in f_input().split()])[::-1]
for i in range(amount):
	if sum(coins[:i + 1]) > sum(coins[i + 1:]):
		f_print(str(i + 1))
		sys_ret(0)


a = int(input())
sum1 = 0
l = []
for a in map(int, input().split()):
	l.append(a)
	sum1 += a
l.sort()
z = len(l) - 1
n = 0
e = 1
while z >= 0:
	n += l[z]
	if sum1 - n < n:
		print(e)
		exit()
	e += 1
	z -= 1


n = int(input())
coins = list(map(int, input().split()))
coins.sort()
summed = sum(coins)
total = 0
if len(coins) > 2:
	for i in range(len(coins) - 1, 0, -1):
		total += 1
		if sum(coins[i:]) > sum(coins[:i]):
			break
	print(total)
elif len(coins) != 1:
	if coins[0] == coins[1]:
		print(2)
	else:
		print(1)
else:
	print(1)


n = int(input())
c = input().split()
c = list(map(int, c))
(y, h) = (0, 0)
nc = 0
while y <= h and n > 0:
	y += max(c)
	c.remove(max(c))
	h = sum(c)
	nc += 1
	n -= 1
print(nc)


def min_coins(coins, n):
	coins.sort(reverse=True)
	total = sum(coins)
	(temp, i) = (0, 0)
	while i < n and temp <= total - temp:
		temp += coins[i]
		i += 1
	return i
n = int(input().strip())
coins = list(map(int, input().strip().split(' ')))
print(min_coins(coins, n))


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
s2 = sum(arr) - arr[-1]
s1 = arr[-1]
n2 = 1
while n - n2 >= 0 and s1 <= s2:
	n2 += 1
	s1 += arr[n - n2]
	s2 -= arr[n - n2]
print(n2)


N = int(input())
C = list(map(int, input().split()))
total = 0
for i in C:
	total += i
C.sort(reverse=True)
ans = 0
amt = 0
while amt <= total / 2:
	amt += C[ans]
	ans += 1
print(ans)


def main():
	numCoins = int(input())
	coins = input().split()
	coins = list(map(int, coins))
	selected = []
	coins.sort()
	findmincoins(coins, selected)
	print(len(selected))

def findmincoins(coins, selected):
	if len(coins) == 0:
		return
	elif sum(selected) > sum(coins):
		return
	else:
		selected.append(coins[len(coins) - 1])
		coins = coins[:len(coins) - 1]
		findmincoins(coins, selected)
main()


n = int(input())
s = list(map(int, input().split()))
s.sort(reverse=True)
x = sum(s)
x = x // 2 + 1
su = 0
c = 0
for j in s:
	su = su + j
	c += 1
	if su >= x:
		break
print(c)


n = int(input())
coin_list = [int(i) for i in input().split()]
coin_list.sort(reverse=True)
total = 0
for i in coin_list:
	total += i
my_money = 0
my_coin_amount = 0
for i in coin_list:
	if my_money <= total - my_money:
		my_money += i
		my_coin_amount += 1
	else:
		break
print(my_coin_amount)


input()
coins = input().split()
coin = []
for i in coins:
	coin.append(int(i))
coin.sort(reverse=True)
money = sum(coin)
mine = 0
count = 0
for i in coin:
	mine = mine + int(i)
	count += 1
	if mine > money / 2:
		break
print(count)


n = int(input())
a = sorted(list(map(int, input().split())))
sm = sum(a)
ct = []
ct.append(a[-1])
i = -2
while sum(ct) <= sm / 2:
	ct.append(a[i])
	i -= 1
print(len(ct))


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
j = 0
total1 = 0
total2 = 0
while total1 <= total2:
	j += 1
	total1 = 0
	for m in range(0, j):
		total1 += a[m]
	total2 = 0
	if j < n:
		for m in range(j, n):
			total2 += a[m]
print(j)


x = int(input())
list_of_coins = sorted(list(map(int, input().split())))
sum_list = sum(list_of_coins) / 2
list_of_coins.reverse()
current_sum = 0
number_of_coins = 0
for i in range(len(list_of_coins)):
	if current_sum <= sum_list:
		current_sum += list_of_coins[i]
		number_of_coins += 1
	if current_sum > sum_list:
		break
print(number_of_coins)


l = []
n = int(input())
ans = 0
a = 0
b = 0
m = input()
l = m.split(' ')
for i in range(n):
	l[i] = int(l[i])
l.sort(reverse=True)
for i in range(n):
	ans += int(l[i])
for j in range(n):
	a += int(l[j])
	b += 1
	if int(2 * a) - ans > 0:
		break
print(str(b))


n = int(input())
coins = [int(x) for x in input().split(' ')]
coins.sort()
s = coins.copy()
suma = s[len(s) - 1]
c = 1
cont = 0
coins.pop()
for x in range(1, len(s)):
	cont = sum(coins)
	if suma > cont:
		break
	else:
		suma += coins[len(coins) - 1]
		c += 1
	coins.pop()
print(c)


n = int(input())
l = list(map(int, input().split()))
s = sum(l)
l.sort()
ans = 0
ss = 0
for i in l[::-1]:
	ss = ss + i
	s = s - i
	ans = ans + 1
	if s < ss:
		break
print(ans)


n = int(input())
arr = [int(i) for i in input().split()]
arr.sort()
(sum1, sum2) = (0, 0)
for i in arr:
	sum2 += i
cnt = n
i = 0
while sum1 < sum2:
	sum1 += arr[i]
	sum2 -= arr[i]
	cnt -= 1
	i += 1
print(cnt + 1)


length = int(input())
coins = list(map(int, input().split(' ')))
coins.sort()
total = sum(coins)
myCoins = 0
numCoins = 0
for i in range(length - 1, -1, -1):
	if myCoins <= total - myCoins:
		myCoins += coins[i]
		numCoins += 1
	else:
		break
print(numCoins)


a = int(input())
b = input()
b = b.split()
T = 0
for x in range(0, len(b)):
	b[x] = int(b[x])
	T = T + b[x]

def sort(array):
	less = []
	equal = []
	greater = []
	if len(array) > 1:
		pivot = array[0]
		for x in array:
			if x < pivot:
				less.append(x)
			if x == pivot:
				equal.append(x)
			if x > pivot:
				greater.append(x)
		return sort(less) + equal + sort(greater)
	else:
		return array
b = sort(b)
m = 0
K = 0
t = len(b) - 1
while T >= K:
	K = K + b[t]
	T = T - b[t]
	m = m + 1
	t = t - 1
print(m)


n = int(input())
s = input().split(' ')
for x in range(n):
	s[x] = int(s[x])
s.sort(reverse=True)
s1 = 0
s2 = sum(s[0:])
i = 1
while s1 <= s2 and i < len(s) + 1:
	s1 = sum(s[0:i])
	s2 = sum(s[i:])
	i += 1
print(i - 1)


n = int(input())
coins = list(map(int, input().split()))
mycoins = []
mycoins.append(max(coins))
coins.remove(max(coins))
counter = 1
while sum(mycoins) <= sum(coins):
	mycoins.append(max(coins))
	coins.remove(max(coins))
	counter += 1
print(counter)


n = int(input())
h = list(map(int, input().split()))
h.sort(reverse=True)
answer = ''
s = 0
for i in range(len(h)):
	s += h[i]
cu = 0
j = 0
for i in range(len(h)):
	if cu <= s / 2:
		cu += h[i]
		j += 1
	else:
		break
print(j)


n = int(input())
z = list(map(int, input().split()))
z.sort(reverse=True)
vb = sum(z)
ans = 0
taken = 0
for i in z:
	taken += i
	ans += 1
	if taken > sum(z) - taken:
		break
print(ans)


n = int(input())
lst = list(map(int, input().split()))
v = counter = 0
for i in range(n):
	if v <= sum(lst):
		v += max(lst)
		lst.remove(max(lst))
		counter += 1
	else:
		break
print(counter)


n = int(input())
money = list(map(int, input().split()))
money.sort()
suma = sum(money)
mini = 0
counter = 0
for i in range(len(money)):
	if mini <= suma:
		mini += money[len(money) - i - 1]
		suma -= money[len(money) - i - 1]
		counter += 1
print(counter)


import math
import sys
import string

def ri():
	return input()

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

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

def mi():
	return list(map(int, input().split()))
n = ii()
a = mi()
a.sort()
a = a[::-1]
you = 0
i = 0
while True:
	you += a[0]
	a.pop(0)
	i += 1
	sib = sum(a)
	if you > sib:
		break
print(i)


import sys
num_cois = input()
coins = list(map(int, input().split(' ')))
coins = sorted(coins, reverse=True)
for i in range(1, len(coins) + 1):
	if sum(coins[:i]) > sum(coins[i:]):
		print(len(coins[:i]))
		sys.exit()
print(0)


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [input() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [int(input()) for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

class PriorityQueue:

	def __init__(self, l=[]):
		self.q = l
		heapq.heapify(self.q)
		return

	def push(self, n):
		heapq.heappush(self.q, n)
		return

	def pop(self):
		return heapq.heappop(self.q)
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def main():
	N = Scanner.int()
	A = Scanner.map_int()
	A.sort(reverse=True)
	a = 0
	b = sum(A)
	for i in range(N):
		a += A[i]
		b -= A[i]
		if a > b:
			print(i + 1)
			return
main()


def twins(n):
	a = things[0]
	del things[0]
	if a > sum(things):
		print(1)
	else:
		j = 1
		while j != 0:
			a += things[0]
			del things[0]
			j += 1
			if a > sum(things):
				print(j)
				j = 0
n = int(input())
things = [int(n) for n in input().split()]
things = sorted(things)
things.reverse()
twins(n)


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
money = 0
coin = 0
x = sum(coins) / 2
for i in coins:
	if money <= x:
		money += i
		coin += 1
	else:
		break
print(coin)


a = int(input())
su = 0
mon = 0
mas = sorted([int(i) for i in input().split()])
for i in reversed(range(a)):
	if su <= sum(mas) / 2:
		mon += 1
		su += mas[i]
print(mon)


import math
n = int(input())
coins = [int(i) for i in input().split()]
coins.sort()
total = 0
for i in coins:
	total += i
need = math.ceil((total + 1) / 2)
num = 0
dex = -1
now = 0
while now < need:
	num += 1
	now += coins[dex]
	dex -= 1
print(num)


n = int(input())
j = list(map(int, input().strip().split()))
j.sort()
s = 0
for x in range(n - 1, -1, -1):
	s += j[x]
	if s > sum(j[:x]):
		print(n - x)
		break


n = int(input())
coins = input().split(' ')
for i in range(len(coins)):
	coins[i] = int(coins[i])
coins.sort()
sm = sum(coins) - coins[-1]
prt = coins[-1]
j = -1
while sm >= prt:
	j -= 1
	prt += coins[j]
	sm -= coins[j]
print(j * -1)


no_coins = input()
coins = sorted([int(c) for c in input().split(' ')])
coin_sum = int(sum(coins) / 2)
count = 0
while coin_sum > 0:
	count += 1
	coin_sum -= coins.pop()
if coin_sum == 0:
	count += 1
print(count)


n = int(input())
s = list(map(int, input().split()))
l = sorted(s)
m = 0
i = 0
while i < n:
	m = m + s[i]
	i = i + 1
a = j = b = 0
while j < n:
	a = a + l[n - 1 - j]
	b = b + 1
	if a * 2 > m:
		j = n
	else:
		j = j + 1
print(b)


n = int(input())
a = input().split()

def sort(a):
	for i in range(0, len(a) - 1):
		for j in range(0, len(a) - 1 - i):
			if int(a[j]) > int(a[j + 1]):
				t = a[j]
				a[j] = a[j + 1]
				a[j + 1] = t
sort(a)
sum = 0
op = 0
for i in range(0, len(a)):
	sum = sum + int(a[i])
for i in range(len(a) - 1, -1, -1):
	op = op + int(a[i])
	if op > sum - op:
		print(len(a) - i)
		break


counter = 1
n = int(input())
v = map(int, input().split())
v = sorted(v, reverse=True)
total = 0
for x in range(0, len(v)):
	total += int(v[x])
p = int(v[0])
for x in range(0, len(v) - 1):
	if p > total / 2:
		break
	else:
		p = p + int(v[x + 1])
		counter += 1
print(counter)


n = int(input())
coin_values = sorted(list(map(int, input().split())), reverse=True)
sum_coins = sum(coin_values)
money = 0
coins = 0
for (idx, value) in enumerate(coin_values):
	if money <= sum_coins / 2:
		money = money + value
		coins += 1
	if money > sum_coins / 2:
		coins_min = coins
		money = money - value
		break
		coins -= 1
print(coins_min)


def coin(a, b):
	outcoins = 0
	coinnumint = int(a)
	coinnumvalsstr = b.split(' ')
	coinnumvals = []
	for x in coinnumvalsstr:
		coinnumvals.append(int(x))
	coinnumvals.sort(reverse=True)
	totalVal = 0
	for y in coinnumvals:
		totalVal += y
	if coinnumint == len(coinnumvals):
		if 1 <= coinnumint <= 100:
			tempval = 0
			for z in coinnumvals:
				outcoins += 1
				tempval += z
				if tempval > totalVal - tempval:
					break
	print(str(outcoins))
coinnum = str(input())
coinvals = str(input())
coin(coinnum, coinvals)


n = int(input())
li = input().split(' ')
l = [int(i) for i in li]
l.sort()
s = sum(l)
cnt = 0
my_s = 0
for i in range(n - 1, -1, -1):
	if my_s <= s // 2:
		cnt += 1
		my_s += l[i]
print(cnt)


n = int(input())
ls = [int(x) for x in input().split()]
ls.sort(reverse=True)
me = 0
s = 0
j = 0
for i in range(n):
	s += ls[i]
while me <= s - me:
	me += ls[j]
	j += 1
print(j)


n = int(input())
an = [int(x) for x in input().split()]
an.sort(reverse=True)
num = 0
averrage = sum(an) / 2
x = 0
for i in range(n):
	x += 1
	num += an[i]
	if num > averrage:
		break
print(x)


n = int(input())
coins = list(map(int, input().split()))
me = []
coins.sort()
while sum(me) < sum(coins) or sum(me) == sum(coins):
	me.append(coins.pop())
print(len(me))


sumlist = []
newlist = []
input()
mylist = [int(i) for i in input().split()]
mylist.sort(reverse=True)
result = 0
for item in mylist:
	result = item + result
	sumlist.append(result)
for item in sumlist:
	if item <= sum(mylist) / 2:
		newlist.append(result)
print(len(newlist) + 1)


n = int(input())
coins = list(map(int, input().split()))
coins.sort()
coins.reverse()
now_value = 0
now_coins = 0
for a in coins:
	if now_value <= sum(coins) / 2:
		now_value += a
		now_coins += 1
	else:
		break
print(now_coins)


n = int(input())
coins = list(map(int, input().split()))
total = sum(coins)
coins.sort()
cnt = 0
more_sum = 0
for i in range(n - 1, -1, -1):
	if more_sum + coins[i] > total / 2:
		break
	cnt += 1
	more_sum += coins[i]
print(cnt + 1)


n = int(input())
l = list(str(input()).split())
for j in range(n):
	l[j] = int(l[j])
s = sum(l)
l.sort(reverse=True)
t = 0
k = 0
for i in range(n):
	t += l[i]
	k += 1
	if t > s / 2:
		break
print(k)


x = input()
x = input().split()
y = []
z = 0
m = 0
for n in x:
	y.append(int(n))
y.sort()
while m <= sum(y):
	m += y.pop()
	z += 1
print(z)


n = int(input())
l = list(map(int, input().split()))
l.sort()
l.reverse()
for j in range(1, len(l) + 1):
	if sum(l[:j]) > sum(l[j:]):
		print(j)
		exit()


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

def multiple_input():
	return map(int, input().split())
n = int(input())
a = list_input()
a.sort(reverse=True)
right = sum(a)
left = 0
ans = n
for i in range(n):
	right -= a[i]
	left += a[i]
	if left > right:
		ans = i + 1
		break
print(ans)


n = int(input())
a = [int(x) for x in input().split(' ')]
a.sort()
half_sum = sum(a) // 2
(m_value, m_count) = (0, 0)
i = n - 1
while m_value <= half_sum:
	m_value += a[i]
	m_count += 1
	i -= 1
print(m_count)


x = int(input())
y = input()
y1 = y.split(' ')
javab = 0
y1 = [int(i) for i in y1]
y1 = sorted(y1, reverse=True)
while sum(y1[:javab]) <= sum(y1[javab:]):
	javab += 1
print(javab)


n = int(input())
l1 = list(map(int, input().split()))
s = sum(l1)
s = s // 2
l1.sort()
c = 0
ans = 0
l1 = l1[::-1]
for item in l1:
	ans += 1
	c += item
	if c > s:
		break
print(ans)


n = int(input())
c = list(map(int, input().split()))
s = 0
me = 0
for i in range(n):
	m = max(c)
	s += m
	c.remove(m)
	me += 1
	if s > sum(c):
		break
print(me)


n = int(input())
l = list(map(int, input().split()))
d = 0
x = 0
l.sort()
i = -1
z = sum(l)
while d <= z:
	d = d + l[i]
	z = z - l[i]
	x = x + 1
	i = i - 1
print(x)


n = int(input())
a = [int(i) for i in input().split()]
m1 = 0
k = 0
while m1 <= sum(a):
	m1 += max(a)
	del a[a.index(max(a))]
	k += 1
print(k)


n = int(input())
l = list(map(int, input().split()))
l.sort()
l.reverse()
sum1 = 0
tos = sum(l)
i = 0
while sum1 <= tos / 2 and i < n:
	sum1 += l[i]
	i += 1
print(i)


n = int(input())
S = [int(x) for x in input().split()]
S.sort(reverse=True)
summm = 0
summ = 0
sb = 0
for i in range(n):
	summm += S[i]
for i in range(n):
	summ += S[i]
	if summ * 2 > summm and sb == 0:
		ans = i + 1
		sb = 1
print(ans)


n = int(input())
coins = list(map(int, input().strip().split(' ')))
coins.sort()
i = n - 1
while sum(coins[:i]) >= sum(coins[i:]):
	i -= 1
	if i == -1:
		break
print(n - i)


def proA(arr):
	arr.sort(reverse=True)
	k = sum(arr) // 2
	co = 0
	for (i, j) in enumerate(arr):
		co += j
		if co > k:
			return i + 1
n = int(input())
arr = list(map(int, input().split()))
print(proA(arr))


t = int(input())
l = list(map(int, input().split()))
l.sort()
x = 1
while sum(l[:t - x]) >= sum(l[t - x:]):
	x += 1
print(x)


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
g = 0
tot = sum(l)
for i in range(n):
	tot -= l[i]
	g += l[i]
	if g > tot:
		print(i + 1)
		break


n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
pingjun = sum(a) / 2
wo = 0
for i in range(n):
	wo = wo + a[i]
	if wo > pingjun:
		print(i + 1)
		break


import sys
n = int(input())
array = list(map(int, input().split()))
array.sort()
p = 1
for i in range(0, n):
	r = 0
	s = 0
	for j in range(0, n - p):
		r += array[j]
	for l in range(0, p):
		s += array[n - l - 1]
	if s > r:
		print(str(p))
		sys.exit()
	else:
		p += 1


def solve():
	n = int(input())
	coins = sorted((int(i) for i in input().split()), reverse=True)
	threshold = sum(coins) // 2
	sum_ = 0
	for (idx, c) in enumerate(coins):
		sum_ += c
		if sum_ > threshold:
			return idx + 1
print(solve())


def solve():
	n = input()
	notes = sorted(list(map(int, input().split())))
	first = 0
	for (i, note) in enumerate(reversed(notes), start=1):
		first += note
		second = sum(notes[:-i])
		if second < first:
			return i
print(solve())


from math import *
import sys, random

def nextInt():
	return int(input())

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

def nextInts():
	return list(map(int, nextStrs()))

def main():
	n = nextInt()
	arr = nextInts()
	arr.sort()
	arr.reverse()
	st = sum((i for i in arr))
	sm = 0
	for i in range(n):
		sm += arr[i]
		if sm > st - sm:
			print(i + 1)
			return 0
	print(-1)
exit(main())


n = int(input())
arr = list(map(int, input().split()))
a = []
b = []
arr = sorted(arr, reverse=True)
for i in range(len(arr)):
	a.append(arr[i])
	b = arr[i + 1:]
	if sum(a) > sum(b):
		print(len(a))
		break


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


n = int(input())
list1 = list(map(int, input().split()))
a = 0
s = 0
b = sum(list1)
list1.sort()
list1.reverse()
while a <= b:
	a = list1[s] + a
	b = b - list1[s]
	s = s + 1
print(s)


n = int(input())
a = list(map(int, input().split()))
a.sort()
total = 0
for i in a:
	total += i
minn = 1
take = a[-minn]
while take <= total / 2:
	minn += 1
	take += a[-minn]
print(minn)


n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
ans = []
while sum(ans) < sum(a):
	ans.append(a[0])
	a.pop(0)
if sum(ans) == sum(a):
	ans.append(0)
	a.pop(0)
print(len(ans))


def getlist(tcast):
	return [tcast(x) for x in input().strip().split(' ')]

def getvar(tcast):
	return tcast(input().strip())
n = getvar(int)
coins = getlist(int)
coins.sort(reverse=True)
total = sum(coins)
have = 0
need = 0
for c in coins:
	have += c
	need += 1
	if have > total / 2:
		break
print(need)


n = int(input())
cs = map(int, input().split())
cs = sorted(cs, reverse=True)
total = sum(cs)
s = 0
for (i, c) in enumerate(cs):
	s += c
	if s > total - s:
		print(i + 1)
		exit()


n = int(input())
coins = sorted(list(map(int, input().split())), reverse=True)
summ = sum(coins)
x = max(coins)
counter = 1
for i in range(1, n):
	if x > summ - x:
		break
	else:
		x += coins[i]
		counter += 1
print(counter)


n = int(input())
coins = [int(i) for i in input().split()]
sum_of_coins = sum(coins)
(sum_of_my_coins, step) = (0, 0)
for coin in sorted(coins, reverse=True):
	sum_of_my_coins += coin
	sum_of_coins -= coin
	step += 1
	if sum_of_my_coins > sum_of_coins:
		break
print(step)


n = int(input())
array = list(map(int, input().split()))
sum_array = sum(array)
array = sorted(array, reverse=True)
sum_array = sum_array // 2
ans = 0
count = 0
for i in range(n):
	ans += array[i]
	count += 1
	if ans > sum_array:
		break
print(count)


num = int(input())
lst = list(map(int, input().split()))
lst.sort(reverse=True)
(s, count) = (0, 0)
i = 0
while True:
	s += lst[i]
	if s > sum(lst) / 2:
		break
	count += 1
	i += 1
print(count + 1)


a = input()
b = list(sorted(map(int, input().split()), reverse=True))
c = sum(b)
(dem, hihi) = (0, 0)
while 1:
	dem += 1
	c -= b[0]
	hihi += b[0]
	b = b[1:]
	if hihi > c:
		print(dem)
		exit()


N = int(input())
Str = input()
Sl = Str.split(' ')
Arr = []
for it in Sl:
	Arr.append(int(it))
Arr.sort()
Arr.reverse()
Ar = 0
for it in Arr:
	Ar = Ar + it
Nr = Day = 0
for it in Arr:
	Nr = Nr + it
	Day += 1
	if Nr > Ar - Nr:
		print(Day)
		break


import math
a = int(input())
b = list(map(int, input().split()))
b.sort(reverse=True)
c = 0
for x in range(len(b)):
	c = c + b[x]
	if c > sum(b) - c:
		print(x + 1)
		break


n = int(input())
s = input().split()
for i in range(n):
	s[i] = int(s[i])
s.sort(reverse=True)
taken = 0
ans = 0
summation = sum(s)
while summation - ans >= ans:
	ans += s[0]
	s.pop(0)
	taken += 1
print(taken)


n = int(input())
l = list(map(int, input().split()))
a = 0
b = 0
i = 0
while a <= b:
	a += max(l)
	l.remove(max(l))
	b = sum(l)
	i += 1
print(i)


n = int(input())
a = input().split()
sum1 = 0
for (i, x) in enumerate(a):
	a[i] = int(a[i])
	sum1 += a[i]
a.sort()
a.reverse()
sum = 0
for (i, x) in enumerate(a):
	sum += a[i]
	if sum > sum1 / 2:
		print(i + 1)
		break


number = int(input())
coinss = input().split(' ')
coins = list(map(int, coinss))
coins.sort(reverse=True)
counter = 0
running = 0
total = sum(coins)
for i in coins:
	running += i
	counter += 1
	if running > total / 2:
		print(counter)
		break


n = int(input())
data = list(map(int, input().split()))
data.sort(reverse=True)
cnt = 0
mySum = 0
while mySum <= sum(data):
	mySum += data[0]
	data.pop(0)
	cnt += 1
print(cnt)


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
suma1 = 0
suma2 = sum(coins)
counter = 0
i = 0
while suma1 <= suma2:
	suma1 += coins[i]
	suma2 += -coins[i]
	i += 1
	counter += 1
print(counter)


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


n = int(input())
l1 = list(map(int, input().split()))
l1.sort()
s = sum(l1) // 2
c = 0
k = 0
for i in range(n - 1, -1, -1):
	if k <= s:
		k += l1[i]
		c += 1
	else:
		break
print(c)


n = int(input())
a = [int(x) for x in input().split()]
s = sum(a)
a.sort(reverse=True)
coins = 1
me = 0
while coins <= n:
	me += a[coins - 1]
	if me > s - me:
		break
	coins += 1
print(coins)


rock = 0
paper = int(input())
scissior = [int(x) for x in input().split()]
scissior.sort(reverse=True)
if len(scissior) == paper:
	(stone, shoe) = (0, sum(scissior))
	for i in scissior:
		if stone <= shoe:
			stone = stone + i
			shoe = shoe - i
			rock = rock + 1
		else:
			break
print(rock)


t = int(input())
coins = input().split()
coins = list(map(int, coins))
coins = sorted(coins, reverse=True)
for x in range(len(coins)):
	if sum(coins[:x + 1]) > sum(coins[x + 1:]):
		print(x + 1)
		break


size = int(input())
coins = [int(value) for value in input().split()]
coins.sort(reverse=True)
half_total = sum(coins) / 2
to_take = 0
num_coins = 0
for coin in coins:
	if to_take > half_total:
		break
	to_take += coin
	num_coins += 1
print(num_coins)


n = int(input())
x = 0
y = 0
m = list(map(int, input().split()))[:n]
h = sum(m) / 2
m.sort()
for i in range(n - 1, -1, -1):
	x += 1
	y += m[i]
	if y > h:
		break
print(x)


n = int(input())
a = []
a = list(map(int, input().split()))
b = []
num1 = 0
i = 0
if n == 1:
	print(1)
elif n == 2:
	if a[0] == a[1]:
		print(n)
	else:
		print(1)
else:
	while num1 <= sum(a):
		num1 += max(a)
		b.append(max(a))
		a.remove(max(a))
		i += 1
	print(len(b))


n = int(input())
str = input()
m = [int(i) for i in str.split(' ')]
m = sorted(m, reverse=True)
sum = 0
for i in range(n):
	sum += m[i]
	left = 0
	for j in range(i + 1, n):
		left += m[j]
	if sum > left:
		print(i + 1)
		break


input()
l = sorted((int(i) for i in input().split()), reverse=1)
m = sum(l) // 2
c = s = 0
while s <= m and c < len(l):
	s += l[c]
	c += 1
print(c)


n = int(input())
c = [int(x) for x in input().split()]
min = sum(c) // 2 + 1
ans = 0
s = 0
for i in sorted(c, reverse=True):
	ans += 1
	s += i
	if s >= min:
		break
print(ans)


count = int(input())
monets = list(map(int, input().split()))
monets2 = []
while True:
	if sum(monets) < sum(monets2):
		break
	else:
		monets2.append(max(monets))
		monets.remove(monets2[-1])
print(len(monets2))


n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
for i in range(n):
	x1 = a[:i + 1]
	x2 = a[i + 1:]
	if sum(x1) > sum(x2):
		print(i + 1)
		break


n = int(input())
l = list(map(int, input().split()))
l.sort()
i = 0
while sum(l[-1 - i:]) <= sum(l[:-1 - i]):
	i = i + 1
print(len(l[-1 - i:]))


a = int(input())
s = 0
c = 0
lis_a = input().split()
for i in range(a):
	lis_a[i] = int(lis_a[i])
	s += lis_a[i]
lis_a.sort(reverse=True)
for j in range(a):
	c += int(lis_a[j])
	if c > s / 2:
		print(j + 1)
		break


count = int(input())
l = list(map(int, input().split(' ')))
l = sorted(l)
b_i = len(l) - 1
n_i = len(l) - 1
b = sum(l[0:b_i])
n = sum(l[n_i:len(l)])
while b >= n:
	b_i -= 1
	n_i -= 1
	b = sum(l[0:b_i])
	n = sum(l[n_i:len(l)])
print(len(l) - n_i)


n = int(input())
money = sorted(list(map(int, input().split())), reverse=True)
Ch2 = sum(money)
Ch1 = 0
for i in range(n):
	Ch2 -= money[i]
	Ch1 += money[i]
	if Ch1 > Ch2:
		print(i + 1)
		break


(n, a, ans, x) = (int(input()), list(map(int, input().split())), 0, 0)
(sum, i) = (sum(a) // 2, n - 1)
a.sort()
while not x > sum:
	x += a[i]
	i -= 1
	ans += 1
print(ans)


n = int(input())
nums = list(map(int, input().split(' ')))
nums.sort()
nums.reverse()
total = sum(nums)
res = 0
cur = 0
for n in nums:
	cur += n
	res += 1
	if cur > total - cur:
		break
print(res)


from sys import stdin, stdout
li = lambda : list(map(int, stdin.readline().split()))
n = int(input())
l = li()
l.sort(reverse=True)
for i in range(n):
	if sum(l[:i + 1]) > sum(l[i + 1:]):
		print(i + 1)
		break


n = input()
l = sorted(map(int, input().split()), reverse=True)
s = sum(l)
t = 0
c = 0
while t <= s / 2:
	t += l[c]
	c = c + 1
print(c)


def main():
	n = int(input())
	coin = [int(elem) for elem in input().split()]
	coin.sort(reverse=True)
	sum_all = 0
	sum_max = sum(coin)
	howmany = 0
	for elem in coin:
		sum_all += elem
		sum_max -= elem
		howmany += 1
		if sum_all > sum_max:
			print(howmany)
			break
main()


input()
s = sorted(list(map(int, input().split())))
temp = 0
answ = 0
while temp <= sum(s):
	temp += s.pop()
	answ += 1
print(answ)


num = int(input())
value = input().split()
value = list(map(int, value))
value2 = []
while value:
	max = 0
	for i in value:
		if i > max:
			max = i
	value.remove(max)
	value2.append(max)
sum = 0
for j in value2:
	sum = sum + int(j)
z = 0
sum2 = sum
k = 0
final = []
while z <= sum:
	z = z + int(value2[k])
	final.append(k)
	sum = sum2 - z
	k = k + 1
print(len(final))


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
s = 0
for x in range(n):
	s += l.pop(0)
	if s > sum(l):
		print(x + 1)
		break
else:
	print(n)


n = input()
a = [int(i) for i in input().split()]
a = sorted(a, reverse=True)
me = 0
twin = 0
for i in range(len(a)):
	me += a[i]
	twin = sum(a[i + 1:])
	if me > twin:
		print(i + 1)
		break


import sys
c = sys.stdin.read().splitlines()
c1 = c[1].split(' ')
c2 = [int(x) for x in c1]
coins = sorted(c2, reverse=True)
s = sum((int(i) for i in coins))
total = int(0)
for (idx, item) in enumerate(coins):
	total = total + int(item)
	if total > s / 2:
		print(idx + 1)
		break


(n, coins) = (int(input()), [int(x) for x in input().split()])
coins.sort()
total = sum(coins)
count = 0
res = 0
for i in range(n - 1, -1, -1):
	res += coins[i]
	count += 1
	if res - total / 2 > 0:
		print(count)
		break


i = int(input())
cv = input().split()
for j in range(len(cv)):
	cv[j] = int(cv[j])
s = sum(cv)
g = 0
l = 0
cv.sort(reverse=True)
if len(cv) == 1:
	print(1)
else:
	for k in cv:
		g += k
		s -= k
		l += 1
		if g > s:
			print(l)
			break


n = int(input())
l = [int(i) for i in input().split()]
l.sort(reverse=True)
max = sum(l)
curr = 0
index = 0
while curr <= max / 2:
	curr += l[index]
	index += 1
print(index)


n = int(input())
mygreedy = 0
coin = 0
listcoin = input().split()
listcoin = [int(x) for x in listcoin]
listcoin.sort(reverse=True)
for i in listcoin:
	if mygreedy > sum(listcoin) / 2:
		break
	else:
		mygreedy = mygreedy + i
		coin = coin + 1
print(coin)


import math
x = int(input())
y = list(map(int, input().split()))
y.sort(reverse=True)
k = 0
s = sum(y)
t = int(s / 2) + 1
for i in range(x):
	k = k + y[i]
	if k >= t:
		print(i + 1)
		break


n = int(input())
coins = [int(x) for x in input().split()]
summe = 0
anzahl = 0
while len(coins) != 0:
	highest = max(coins)
	summe += highest
	anzahl += 1
	coins.remove(highest)
	if summe > sum(coins):
		break
print(anzahl)


num = int(input())
coins = list(map(int, input().split()))
sum = 0
maxi = 0
counter = 0
for i in range(len(coins)):
	sum += coins[i]
for k in range(len(coins)):
	for j in range(len(coins)):
		maxi += max(coins)
		sum -= max(coins)
		maxi_index = coins.index(max(coins))
		coins[maxi_index] = -1
		counter += 1
		if sum < maxi:
			print(counter)
			exit(0)


n = int(input())
m = list(map(int, input().split()))
m.sort(reverse=True)
s = sum(m)
counter = 0
index = 0
for i in m:
	index += 1
	counter += i
	if counter > s - counter:
		print(index)
		break


n = int(input())
A = [int(x) for x in input().split()]
B = sorted(A)
C = B[::-1]
mine = tmine = 0
tmoney = sum(A)
for i in range(n):
	if mine + C[i] <= tmoney / 2:
		tmine += 1
		mine += C[i]
	else:
		break
print(tmine + 1)


i = int(input())
n = [int(temp_array) for temp_array in input().split()]
n.sort()
lst = []
for x in range(len(n) - 1, -1, -1):
	lst.append(n[x])
sum1 = 0
count = 0
lst1 = []
for x in range(0, len(lst)):
	sum1 += lst[x]
	count += 1
	for j in range(x + 1, len(lst)):
		lst1.append(lst[j])
	if sum1 > sum(lst1):
		break
	lst1.clear()
print(count)


def buble(seq):
	fim = len(seq)
	for i in range(fim - 1, 0, -1):
		houve_troca = False
		for pos in range(i):
			if seq[pos] < seq[pos + 1]:
				(seq[pos], seq[pos + 1]) = (seq[pos + 1], seq[pos])
				houve_troca = True
		if not houve_troca:
			return

def main():
	m = int(input())
	moedas = [int(x) for x in input().split()]
	buble(moedas)
	print(min_moedas(moedas))

def min_moedas(moedas):
	i = 0
	while True:
		if sum(moedas[:i + 1]) > sum(moedas[i + 1:]):
			return i + 1
		i += 1
main()


n = int(input())
cnt = 0
nums = list(map(int, input().split()))
nums.sort(reverse=True)
c = 0
s = sum(nums)
for i in range(n):
	s -= nums[i]
	c += nums[i]
	cnt += 1
	if c > s:
		print(cnt)
		break


n = int(input())
arr = [int(n) for n in input().split()]
ar = sorted(arr)
array = [ele for ele in reversed(ar)]
s = 0
for i in range(n):
	s = s + array[i]
	sum = 0
	for j in range(i + 1, n):
		sum = sum + array[j]
	if s > sum:
		print(i + 1)
		break
	else:
		continue


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
s = sum(a)
t = 0
coins = 0
while t <= s - t:
	t += a.pop()
	coins += 1
print(coins)


n = int(input())
l = list(map(int, input().split()))
l.sort()
z = sum(l)
c = 0
count = 0
for x in range(len(l) - 1, -1, -1):
	c += l[x]
	count += 1
	if c > z / 2:
		break
print(count)


n = int(input())
a = sorted(list(map(int, input().split())))
b = []
k = 0
while sum(b) <= sum(a):
	b.append(a[-1])
	a.remove(a[-1])
	k += 1
print(k)


input()
a = sorted(list(map(int, input().split())))
b = c = 0
sum_a = sum(a) / 2
while b <= sum_a:
	b += a.pop()
	c += 1
print(c)


num = int(input())
coins = input().split()
coins = [int(x) for x in coins]
coins.sort(reverse=True)
coinSum = 0
answer = 0
for i in range(num):
	if coinSum > sum(list(coins[i:])):
		break
	else:
		coinSum += coins[i]
		answer += 1
print(answer)


from sys import stdin, stdout
input = lambda : stdin.readline().strip()
n = int(input())
lst = [int(i) for i in input().split()]
lst.sort(reverse=True)
nd = 0
sum1 = 0
i = 0
while i < n:
	if sum1 <= sum(lst[i:]):
		sum1 += lst[i]
		nd += 1
	else:
		break
	i += 1
print(nd)


n = input()
x = list(map(int, input().split()))
x.sort()
k = 0
j = len(x)
for i in range(j):
	if sum(x[j - i - 1:j]) > sum(x[0:j - i - 1]):
		k = k + 1
		break
	else:
		k = k + 1
print(k)


n = int(input())
chars = input().split(' ')
money = []
for i in chars:
	money.append(int(i))
for i in range(len(money)):
	element = money[i]
	j = i
	while j > 0 and money[j - 1] < element:
		money[j] = money[j - 1]
		j -= 1
	money[j] = element
s = 0
mine = 0
k = 0
for i in money:
	s += i
while mine <= s:
	mine += money[k]
	s -= money[k]
	k += 1
print(k)


n = int(input())
s = input().split()
i = 0
for u in range(0, len(s)):
	s[u] = int(s[u])
maxsum = 0
while True:
	maxsum += max(s)
	del s[s.index(max(s))]
	i += 1
	if sum(s) < maxsum:
		break
print(i)


n = int(input())
a = [int(x) for x in input().split()]
s = []
ans = 0
a.sort()
a.reverse()
for i in range(n):
	s = a[:i]
	if sum(s) > sum(a[i:]):
		ans = len(s)
		break
print(ans if ans != 0 else len(a))


myshare = count = 0
n = int(input())
allCoins = list(map(int, input().split()))
allCoins.sort()
while True:
	myshare += allCoins.pop()
	count += 1
	if sum(allCoins) < myshare:
		break
print(count)


n = int(input())
a = [int(i) for i in input().split()]
a = sorted(a)
sum = 0
for i in range(0, len(a)):
	sum = sum + a[i]
b = a.reverse()
c = 0
for i in range(0, len(a)):
	c = c + a[i]
	if c > sum // 2:
		print(i + 1)
		break


import time
import math
from sys import stdin, stdout

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

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

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

def Li():
	return sorted(list(map(int, stdin.readline().split())))

def Lr():
	return sorted(list(map(int, stdin.readline().split())), reverse=True)

def P(x):
	return stdout.write(str(x))

def Pi(x, y):
	return stdout.write(str(x) + ' ' + str(y))

def solve():
	n = I()
	l = Lr()
	s = sum(l) - l[0]
	(coin, ans) = (l[0], 1)
	for i in range(1, n):
		if coin > s:
			break
		else:
			ans += 1
			coin += l[i]
			s -= l[i]
	P(ans)
solve()


def minumumToHaveMore(coins):
	total = 0
	amount = [0] * 101
	for coin in coins:
		total += int(coin)
		amount[int(coin)] += 1
	needed = total // 2 + 1
	i = 100
	have = 0
	while i * amount[i] < needed:
		have += amount[i]
		needed -= i * amount[i]
		i -= 1
	return have + needed // i + (1 if needed % i > 0 else 0)
useless = input()
print(minumumToHaveMore(input().split()))


n = input()
arr = sorted(map(int, input().split()), reverse=True)
jum = sum(arr)
jum1 = idx = 0
while jum1 <= jum / 2:
	jum1 += arr[idx]
	idx += 1
print(idx)


n = int(input())
list1 = input().split()
for i in range(n):
	list1[i] = int(list1[i])
list1.sort(reverse=True)
sum = 0
for i in range(n):
	sum += list1[i]
sum = sum // 2 + 1
number = 0
total = 0
for i in range(n):
	number = number + list1[i]
	total += 1
	if number >= sum:
		break
print(total)


n = int(input())
coinValue = [int(i) for i in input().split()]
sums = 0
count = 0
coinValue = sorted(coinValue, reverse=True)
for i in range(n):
	sums += coinValue[i]
	count += 1
	if sum(coinValue[i + 1:len(coinValue)]) < sums:
		break
print(count)


n = int(input())
arr = [int(i) for i in input().split(' ')]
arr.sort()
(arr_a, arr_b) = ([], [])
arr_a.append(arr[n - 1])
for i in range(0, n - 1):
	arr_b.append(arr[i])
c = 1
k = len(arr_b)
while k > 0:
	if sum(arr_a) <= sum(arr_b):
		arr_a.append(max(arr_b))
		del arr_b[len(arr_b) - 1]
		c = c + 1
	k = k - 1
	pass
print(c)


def Twins(numberOfCoins, Coins):
	sortedCoins = sorted(Coins)
	i = numberOfCoins
	coinsTaken = 1
	while i > 0:
		WinnningIndex = -1 * coinsTaken
		LosingIndex = numberOfCoins + WinnningIndex
		if sum(sortedCoins[WinnningIndex:]) > sum(sortedCoins[:LosingIndex]):
			return coinsTaken
		coinsTaken += 1
		i -= 1
noOfCoins = int(input())
coins = [int(x) for x in input().split()]
print(Twins(noOfCoins, coins))


n = int(input())
data = list(map(int, input().split()))
data.sort(reverse=True)
s = sum(data)
sy = 0
for i in range(n):
	sy += data[i]
	if 2 * sy > s:
		print(i + 1)
		break


n = int(input())
w = list(map(lambda x: int(x), input().split()))
t = sum(w)
w = sorted(w)
ans = 0
if n == 1:
	ans = 1
else:
	for i in range(n - 1, -1, -1):
		ts = sum(w[i:n])
		if ts > t - ts:
			ans = n - i
			break
print(ans)


coin_num = int(input())
coin_values = input().split()
max_value = 0
for i in range(len(coin_values)):
	coin_values[i] = int(coin_values[i])
	max_value += coin_values[i]
coin_values.sort()
coins_value = 0
coins = 0
while coins_value <= max_value / 2:
	coins_value += coin_values.pop(len(coin_values) - 1)
	coins += 1
print(coins)


n = int(input())
coins = list(map(int, input().split()))
coins.sort()
s = sum(coins)
cur = 0
while s >= cur:
	s -= coins[-1]
	cur += coins.pop()
print(n - len(coins))


input()
s = sorted(map(int, list(input().split())))
i = su = 0
while su <= sum(s):
	su += s.pop()
	i += 1
print(i)


n = int(input())
count = 0
m = 0
i = 0
s = list(map(int, input().split()))
s.sort()
s.reverse()
a = sum(s)
while a - m >= m:
	m = m + s[i]
	count += 1
	i += 1
print(count)


t = int(input())
c = input()
d = []
c1 = 0
for x in c.split():
	d.append(int(x))
hsum = sum(d)
lsum = 0
d.sort()
j = t - 1
while lsum <= hsum:
	c1 = c1 + 1
	hsum = hsum - d[j]
	lsum = lsum + d[j]
	j = j - 1
print(c1)


n = int(input())
li = [int(i) for i in input().split()]
li.sort(reverse=True)
s = 0
k = 0
s1 = sum(li)
while s <= s1:
	s = s + li[k]
	s1 = s1 - li[k]
	k = k + 1
print(k)


n = int(input())
x = [int(z) for z in input().split()]
y = x.copy()
y.sort(reverse=True)
a = 0
b = 0
c = 0
for i in range(n):
	b = b + x[i]
for i in range(n):
	a = a + y[i]
	c = c + 1
	if 2 * a > b:
		print(c)
		break


n = int(input())
groups = [int(a) for a in input().split(' ')]
sum = 0
for geld in groups:
	sum += geld
we_have = 0
we_take = 0
while we_have <= sum - we_have:
	max = groups[0]
	count = 0
	while count < len(groups):
		h = groups[count]
		if h > max:
			max = h
		count = count + 1
	we_have += max
	we_take += 1
	groups.remove(max)
print(we_take)


n = int(input())
coins = list(map(int, input().split()))
total = sum(coins)
curr_sum = 0
n_coins = 0
for i in sorted(coins, reverse=True):
	curr_sum += i
	n_coins += 1
	if curr_sum > total // 2:
		break
print(n_coins)


n = int(input())
value = [int(x) for x in input().split(' ')]
sum = 0
for x in value:
	sum += x
avg = sum / 2
count = 0
sum = 0
for x in sorted(value, reverse=True):
	count += 1
	sum += x
	if sum > avg:
		break
print(count)


n = int(input())
temp = input()
sum = 0
ar = list(map(int, temp.split(' ')))
for x in ar:
	sum = sum + x
ar.sort()
ar.reverse()
co = 0
val = 0
for x in ar:
	if val <= sum:
		sum = sum - x
		val = val + x
		co += 1
	else:
		break
print(co)


def twins():
	n = int(input())
	coins = input().split(' ')
	quicksort(coins, 0, n - 1)
	total = 0
	i = n - 1
	sum = 0
	remaining = 0
	for j in range(n):
		remaining += int(coins[j])
	while i >= 0 and sum <= remaining:
		sum += int(coins[i])
		remaining -= int(coins[i])
		total += 1
		i -= 1
	print(total)

def quicksort(A, lo, hi):
	if lo < hi:
		p = partition(A, lo, hi)
		quicksort(A, lo, p - 1)
		quicksort(A, p + 1, hi)

def partition(A, lo, hi):
	pivot = int(A[hi])
	i = lo - 1
	for j in range(lo, hi):
		if int(A[j]) <= pivot:
			i = i + 1
			(A[i], A[j]) = (A[j], A[i])
	(A[i + 1], A[hi]) = (A[hi], A[i + 1])
	return i + 1
twins()


def countMinAmount(n, list):
	if n == 1:
		return 1
	arr = []
	for i in range(len(list)):
		arr.append(int(list[i]))
	arr.sort()
	res = 1
	sum1 = 0
	sum2 = int(arr[len(arr) - 1])
	for i in range(n - 1):
		sum1 += int(arr[i])
	i = 2
	while sum1 >= sum2:
		res += 1
		t = int(arr[len(arr) - i])
		sum2 += t
		sum1 -= t
		i += 1
	return res
n = int(input())
list = input().split(' ')
print(countMinAmount(n, list))


x = int(input())
n = list(map(int, input().split()))
l = sorted(n, reverse=True)
k = 0
j = 0
s = sum(l) // 2
while s + 1 > k:
	k += l[j]
	j += 1
print(j)


n = int(input())
s = list(map(int, input().split()))
s.sort(reverse=True)
t = 0
for j in range(len(s)):
	t = t + s[j]
b = 0
a = 0
for i in range(n):
	c = t - a
	if a <= c:
		a += s[i]
		b += 1
	else:
		break
print(b)


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
m = sum(a) / 2
s = 0
i = len(a) - 1
while s <= m:
	s += a[i]
	i -= 1
print(len(a) - i - 1)


n = int(input())
arr = [int(x) for x in input().split()]
arr.sort()
sum = 0
for i in range(0, n):
	sum = sum + arr[i]
count = 0
sum2 = 0
for i in range(0, n):
	sum2 = sum2 + arr[n - i - 1]
	sum = sum - arr[n - i - 1]
	if sum < sum2:
		count = count + 1
		print(count)
		break
	else:
		count = count + 1


n = int(input())
l = list(map(int, input().split()))
_sum = 0
_coin = 0
while True:
	if _sum <= sum(l):
		_sum += max(l)
		l.remove(max(l))
		_coin += 1
	else:
		break
print(_coin)


N = int(input())
X = [int(x) for x in input().split()]
X.sort(reverse=True)
S = sum(X)
Tr = 0
n = 0
while Tr * 2 < S or Tr * 2 == S:
	Tr = Tr + X[n]
	n = n + 1
print(n)


n = int(input())
g = input().split()
g = [int(s) for s in g]
g.sort()
ct = mx = sm = 0
inc = 1
while True:
	mx += g[n - inc]
	ct += 1
	for i in range(n - inc):
		sm += g[i]
	if mx > sm:
		print(ct)
		break
	inc += 1
	sm = 0


def getMyCoins(coins):
	sumAll = sum(coins)
	(mySum, myCoins) = (0, 0)
	for coin in sorted(coins, reverse=True):
		if mySum > sumAll - mySum:
			break
		mySum += coin
		myCoins += 1
	return myCoins
n = int(input())
coins = list(map(int, input().split(' ')))
print(getMyCoins(coins))


n = int(input())
coin = input()
coin = coin.split(' ')
for i in range(n):
	coin[i] = int(coin[i])
sum = 0
for i in range(n):
	sum = sum + coin[i]
half = sum / 2
my = 0
i = 0
while my <= half:
	take = max(coin)
	my = my + take
	i = i + 1
	coin.remove(take)
print(i)


def _160A(values):
	values = sorted(values, reverse=True)
	chosen = []
	while sum(chosen) <= sum(values):
		chosen.append(values[0])
		values = values[1:]
	return len(chosen)
input()
values = list(map(lambda x: int(x), input().split()))
print(_160A(values))


n = int(input())
coin = list(input().split())
coins = []
for i in coin:
	coins.append(int(i))
total = sum((int(i) for i in coins))
coins.sort()
coins.reverse()
i = 0
mine = 0
while mine <= total / 2:
	mine = mine + int(coins[i])
	i = i + 1
print(i)


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
m = sum(l) // 2
c = 0
ans = 0
for i in range(n):
	if c > m:
		break
	else:
		c += l[i]
		ans += 1
print(ans)


t = int(input())
l = list(map(int, input().split()))
su = sum(l)
halfsum = su // 2
l = sorted(l)
l = l[::-1]
counter = 0
ss = 0
for i in l:
	ss += i
	counter += 1
	if ss > halfsum:
		break
print(counter)


n = input()
c = list(map(int, input().split()))
s = sum(c)
h = s / 2
cs = sorted(c, reverse=True)
m = 0
i = 0
for x in cs:
	i += 1
	m += x
	if m > h:
		break
print(i)


n = int(input(''))
list1 = list(map(int, input().split()))
list1.sort()
l = sum(list1)
count = 0
m = 0
for i in range(len(list1) - 1, -1, -1):
	m = m + list1[i]
	count += 1
	if m > l // 2:
		print(count)
		break
	else:
		continue


n = int(input())
a = list(map(int, input().split()))
b = sorted(a)
b.reverse()
s = 0
lph = 0
c = sum(a)
if n == 1:
	print('1')
else:
	for i in range(len(b)):
		if s <= c / 2:
			s = s + b[i]
			lph += 1
		else:
			break
	print(lph)


n = int(input())
lst = list(map(int, input().split()))
lst = sorted(lst)
lst = list(reversed(lst))
sum1 = 0
count = 0
for i in range(len(lst)):
	sum1 = sum1 + lst[i]
	sum2 = 0
	count = count + 1
	for j in range(i + 1, len(lst)):
		sum2 = sum2 + lst[j]
	if sum1 > sum2:
		break
print(count)


n = int(input())
coins = list(map(int, input().split()))
total = sum((a for a in coins))
coins.sort(reverse=True)
ans = 0
c = 0
for x in coins:
	if ans <= total - ans:
		ans += x
		c += 1
	else:
		break
print(c)


num = int(input())
array = list(map(int, input().split()))
array.sort(reverse=True)
rec = len(array)
for i in range(num):
	if sum(array[:i + 1]) > sum(array[i + 1:]):
		rec = len(array[:i + 1])
		break
print(rec)


n = int(input())
a = list(map(int, input().split()))
s1 = 0
s2 = sum(a)
i = 0
while s1 <= s2:
	k = 0
	for j in range(1, n - i):
		if a[k] < a[j]:
			k = j
	s1 += a[k]
	s2 -= a[k]
	if k != n - i - 1:
		(a[k], a[n - i - 1]) = (a[n - i - 1], a[k])
	i += 1
print(i)


n = int(input())
liSt = list(map(int, input().strip().split()))
sums = count = 0
liSt.sort()
for i in reversed(range(len(liSt))):
	sums = sums + liSt[i]
	liSt.remove(liSt[i])
	count += 1
	if sums > sum(liSt):
		break
print(count)


n = int(input())
a = list((int(x) for x in input().split()))
a.sort()
a = a[::-1]
sum = 0
for i in a:
	sum += i
sum = sum // 2
count_sum = counter = i = 0
while count_sum <= sum and i < n:
	count_sum += a[i]
	counter += 1
	i += 1
print(counter)


n = int(input())
lis = sorted(list(map(int, input().split())), reverse=True)
cnt = 1
for i in range(n):
	while sum(lis[:i + 1]) <= sum(lis[i + 1:]):
		cnt += 1
		break
print(cnt)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
summ = 0
coins = 0
total = sum(a) // 2
for i in range(len(a) - 1, -1, -1):
	if summ <= total:
		summ += a[i]
		coins += 1
	else:
		break
print(coins)


n = int(input())
coins = sorted(list(map(int, input().split())), reverse=True)
tot = 0
done = 0
for i in range(len(coins)):
	if tot <= sum(coins) // 2:
		tot += coins[i]
		done += 1
print(done)


n = int(input())
lst = list(map(int, input().split()))
lst.sort(reverse=True)
sm = sum(lst)
t = 0
i = 0
while t <= sm - t:
	t = t + lst[i]
	i = i + 1
print(i)


num_coins = input()
vals = sorted(list(map(int, input().split())), reverse=True)
my_coins = 0
my_val = 0
for i in range(len(vals)):
	if my_val <= sum(vals) // 2:
		my_val += vals[i]
		my_coins += 1
	else:
		break
print(my_coins)


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


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
(t1, t2) = (0, sum(coins))
for i in range(len(coins)):
	t1 += coins[i]
	t2 -= coins[i]
	if t1 > t2:
		break
print(i + 1)


n = int(input())
s = sorted(list(map(int, input().split())), reverse=True)

def x(s, i=1):
	t = 0
	for j in range(i):
		t += s[j]
	if t > sum(s[i:]):
		print(i)
	else:
		x(s, i + 1)
x(s)


n = int(input())
money = [int(x) for x in input().split()]
money.sort()
money.reverse()
i = 0
mine = []
while i <= n:
	mine.append(money[i])
	if sum(mine) > 1 / 2 * sum(money):
		print(i + 1)
		break
	else:
		i = i + 1


def sele_sort(n):
	for i in range(len(n)):
		min_num = i
		for j in range(i + 1, len(n)):
			if n[min_num] > n[j]:
				min_num = j
		temp = n[i]
		n[i] = n[min_num]
		n[min_num] = temp
x = int(input())
ls = list(map(int, input().split()))
sum1 = 0
sum2 = 0
coun = 0
for i in ls:
	sum1 += i
sum1 = int(sum1 / 2)
sele_sort(ls)
for i in range(len(ls) - 1, -1, -1):
	sum2 += ls[i]
	coun += 1
	if sum2 > sum1:
		break
print(coun)


n = int(input())
input_list = input().split()
input_list = list(map(int, input_list))
total = sum(input_list)
summation = 0
count = 0
while summation <= total / 2:
	count += 1
	i = max(input_list)
	summation += i
	input_list.remove(i)
print(count)


import math

def greedymin(l):
	s = int(math.floor(math.fsum(l) / 2))
	(c, t) = (0, 0)
	l.sort(reverse=True)
	for x in l:
		if t + x <= s:
			t = t + x
			c += 1
		else:
			break
	return c + 1
n = input()
l = list(map(int, input().split()))
print(greedymin(l))


x = int(input())
y = [int(b) for b in input().split()]
y = sorted(y, reverse=True)
z = 0
for i in range(len(y)):
	z += 1
	if sum(y[0:i + 1]) > sum(y[i + 1:]):
		break
print(z)


a = int(input())
list = [int(x) for x in input().split()]
s = sum(list)
p = num = 0
while p <= s / 2:
	num += 1
	p += max(list)
	list.remove(max(list))
print(num)


t = input()
r = list(map(int, input().split()))
r = sorted(r)
l = []
while sum(l) <= sum(r):
	l.append(r.pop())
print(len(l))


coins = int(input())
l1 = list(map(int, input().split()))
l1.sort()
l2 = [0]
for i in l1:
	l2.append(l2[-1] + i)
c = 0
for i in range(len(l2) - 2, -1, -1):
	c += 1
	if l2[-1] - l2[i] > l2[i]:
		break
print(c)


def main():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	tot = sum(a)
	myTot = 0
	count = 0
	for i in range(n):
		if myTot <= tot - myTot:
			myTot += a[i]
			count += 1
		else:
			break
	print(count)
main()


n = int(input())
l = list(map(int, input().split()))
l = sorted(l)[::-1]
s1 = 0
s2 = sum(l)
i = 0
while i < n and s1 <= s2:
	s1 = s1 + l[i]
	s2 = s2 - l[i]
	i = i + 1
print(i)


def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def solve():
	N = getInt()
	C = getInts()
	C.sort()
	sumC = sum(C)
	(count, curr_sum) = (0, 0)
	while True:
		count += 1
		curr_sum += C.pop()
		if curr_sum > sumC / 2:
			return count
ans = solve()
print(ans)


n = int(input())
coins = input().split()
total = 0
for i in range(n):
	coins[i] = int(coins[i])
	total = total + coins[i]
coins = sorted(coins, reverse=True)
max_sum = 0
remaining = 0
min_coins = 0
for i in coins:
	max_sum = max_sum + int(i)
	remaining = total - max_sum
	min_coins = min_coins + 1
	if max_sum > remaining:
		break
print(min_coins)


sum2 = 0
c = 0
n = int(input())
for i in range(1):
	a = sorted(map(int, input().split()))
while sum2 <= sum(a):
	sum2 = sum2 + a.pop()
	c += 1
print(c)


n = int(input())
arr = list(map(int, input().split(' ')))
arr.sort()
arr.reverse()
sum_ = sum(arr) // 2
k = 0
ans = 0
for i in range(n):
	if k > sum_:
		break
	else:
		k += arr[i]
		ans += 1
print(ans)


n = int(input())
lis = list(map(int, input().strip().split()))[:n]
lis.sort(reverse=True)
sum1 = 0
sum2 = 0
num = 0
for i in range(len(lis)):
	sum1 += lis[i]
	sum2 = sum(lis[i + 1:n])
	num += 1
	if sum1 > sum2:
		break
print(num)


import sys
import math
n = int(input())
a = map(int, input().split())
a = sorted(a)
cnt = ans = 0
while ans <= sum(a):
	ans += a.pop()
	cnt += 1
print(cnt)


n = int(input())
values = [int(x) for x in input().split()]
values.sort(reverse=True)
value_taken = 0
coins_taken = 0
value_left = sum(values)
for i in range(n):
	if value_taken <= value_left:
		coins_taken += 1
		value_taken += values[0]
		value_left -= values[0]
		values.pop(0)
	else:
		break
print(coins_taken)


n = int(input())
l = list(map(int, input().split()))
l.sort()
(i, c, t, s) = (n - 1, 1, l[n - 1], sum(l))
while t <= s - t:
	t += l[i - 1]
	i -= 1
	c += 1
print(c)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
s = sum(a) / 2
for i in range(len(a) + 1):
	if sum(a[:i]) >= s:
		break
print(len(a) - (i - 1))


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x) + '\n')
n = get_int()
lst = sorted(get_int_list(), reverse=True)
s = sum(lst)
t = 0
flag = False
for i in range(n):
	if t > s - t:
		print(i)
		flag = True
		break
	else:
		t += lst[i]
if not flag:
	print(n)


__author__ = 'Utena'
n = input()
s = sorted(list(map(int, input().split())), key=lambda x: x, reverse=1)
t = sum(s) / 2
t1 = 0
for i in range(len(s)):
	t1 += s[i]
	if t1 > t:
		print(i + 1)
		break


input_list = []
num = 0
while True:
	if num == 2:
		break
	line = input()
	line = line.split()
	line = list(map(int, line))
	input_list.append(line)
	num += 1
input_list.pop(0)
nlist = input_list[0]
nlist.sort(reverse=True)
count = 0
counter = 0
while count <= sum(nlist) - count:
	count += nlist[counter]
	counter += 1
print(counter)


def coins(a, n):
	a.sort()
	sum1 = sum(a)
	x = 0
	for i in range(n):
		x = x + a[n - i - 1]
		sum1 = sum1 - a[n - i - 1]
		if sum1 < x:
			return i + 1
n = int(input())
a = list(map(int, input().split()))
print(coins(a, n))


n = int(input())
vls = list(map(int, input().split()))
x = []
while True:
	x.append(max(vls))
	vls.remove(x[-1])
	if sum(x) > sum(vls):
		print(len(x))
		break


a = int(input())
x = list(map(int, input().split()))
x.sort(reverse=True)
d = sum(x)
d = int(d / 2) + 1
i = 0
s = 0
for j in x:
	s = s + j
	i += 1
	if s >= d:
		break
print(i)


import math
import os
import random
import re
import sys

def solve(n, coins):
	total = 0
	for coin in coins:
		total += coin
	coins.sort(reverse=True)
	yourTotal = 0
	yourCoinsCount = 0
	halfTotal = total / 2
	for coin in coins:
		if yourTotal > halfTotal:
			break
		yourTotal += coin
		yourCoinsCount += 1
	return yourCoinsCount
n = int(input())
coins = list(map(int, input().split(' ')))
print(solve(n, coins))


x = int(input())
lis = list(map(int, input().split()))
lis.sort(reverse=True)
total = 0
tl = sum(lis) // 2
for i in range(x):
	total = total + lis[i]
	if total > tl:
		print(i + 1)
		break


import math
n = int(input(''))
coins = sorted([int(i) for i in input('').split(' ')[:n]])
(sh, cnt) = (0, 0)
for i in range(n - 1, -1, -1):
	if sh < math.floor(sum(coins) / 2) + 1:
		sh += coins[i]
		cnt += 1
	else:
		break
print(cnt)


input()
coins = [int(i) for i in input().split()]
coins.sort()
for i in range(1, len(coins) + 1):
	if sum(coins[-i:]) > sum(coins[:len(coins) - i]):
		print(i)
		break


N = int(input())
coinvals = list(map(int, input().split()))
coinvals.sort(reverse=True)
for x in range(len(coinvals)):
	if x == 0:
		continue
	else:
		coinvals[x] += coinvals[x - 1]
num = 0
while coinvals[num] * 2 <= coinvals[-1]:
	num += 1
print(num + 1)


n = int(input())
b = sorted([int(i) for i in input().split()])
d = 0
f = 0
for i in range(len(b), 0, -1):
	if sum(b[i:]) > sum(b) / 2:
		print(d)
		exit()
	else:
		d += 1
print(d)


N = int(input())
coins = [int(x) for x in input().split()]
coins.sort(reverse=True)
for i in range(1, N + 1):
	if sum(coins[:i]) > sum(coins) / 2:
		print(i)
		break


n = int(input())
coins = list(map(int, input().rstrip().split()))
coins.sort(reverse=True)
total = 0
remain = 0
for i in range(1, n + 1):
	total += coins[i - 1]
	remain = sum(coins[i:])
	if total > remain:
		print(i)
		break


from sys import stdin, stdout
nb_coins = int(stdin.readline())
coins = list(map(int, stdin.readline().split()))
coins.sort(reverse=True)
res = 0
half_of_sum_coins = sum(coins) // 2
me = 0
for i in coins:
	if me > half_of_sum_coins:
		break
	me += i
	res += 1
stdout.write(str(res) + '\n')


N = input()
A = input()
coins = A.split()
coins = list(map(int, coins))
coins = sorted(coins, reverse=True)
s = sum(coins) / 2
counter = 0
current = 0
for i in coins:
	i = float(i)
	current += i
	counter += 1
	if current > s:
		break
print(counter)


def sumpar(arr, n1, n2):
	sum1 = 0
	for i in range(n1, n2):
		sum1 += arr[i]
	return sum1
n = int(input())
arr = input().split()
arr1 = []
for x in arr:
	arr1.append(int(x))
arr1.sort()
arr2 = arr1[::-1]
i = 1
sum1 = sumpar(arr2, 0, i)
sum2 = sumpar(arr2, i, len(arr2))
while sum1 <= sum2:
	i += 1
	sum1 = sumpar(arr2, 0, i)
	sum2 = sumpar(arr2, i, len(arr2))
print(i)


n = int(input())
array1 = list(map(int, input().strip().split()))
sum1 = sum(array1)
(c1, c2) = (0, 0)
array1.sort(reverse=True)
for i in array1:
	c1 += i
	sum1 -= i
	c2 += 1
	if c1 > sum1:
		break
print(c2)


n = int(input())
x = map(int, input().split())
x = sorted(x)
t1 = 0
t2 = 0
counter = 0
for i in x:
	t1 = t1 + i
for i in x[::-1]:
	t2 = t2 + i
	counter = counter + 1
	if t2 > t1 / 2:
		break
print(counter)


from math import *
t = int(input())
l = list(map(int, input().split()))
j = ceil(sum(l) / 2)
p = sorted(l, reverse=True)
c = 0
i = 0
m = 0
while m < j:
	m += p[i]
	i = i + 1
	c = c + 1
if m == j:
	if sum(p[0:c]) == sum(p[c:]):
		print(c + 1)
	else:
		print(c)
else:
	print(c)


n = int(input())
lots = input().split()
lots = [int(lots[x]) for x in range(0, len(lots))]
lots.sort()
s1 = 0
for i in range(0, len(lots)):
	s1 += lots[i]
s2 = 0
indi = 0
k = 0
for i in range(len(lots) - 1, -1, -1):
	s2 += lots[i]
	k += 1
	if s2 > s1 - s2:
		indi = k
		break
print(indi)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
sum1 = 0
t = True
i = 0
count = 0
while t == True:
	sum1 = sum1 + a[i]
	count += 1
	if sum1 > sum(a) - sum1:
		t = False
	else:
		i = i + 1
print(count)


n = int(input())
a = map(int, input().split())
t = 0
l = 0
a = sorted(a)
k = a[::-1]
r = sum(k)
for i in k:
	t += i
	l += 1
	if t > r / 2:
		print(l)
		break


I = lambda : list(map(int, input().split()))
[h] = I()
x = I()
x.sort(reverse=True)
a = sum(x) / 2
s = 0
k = 0
for i in x:
	if a >= s:
		s = s + i
	else:
		break
	k = k + 1
print(k)


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())
n = inp()
coins = sorted(invr(), reverse=True)
amt_remaining = sum(coins)
amt_taken = 0
coins_taken = 0
while amt_taken <= amt_remaining:
	amt_taken += coins[coins_taken]
	amt_remaining -= coins[coins_taken]
	coins_taken += 1
print(coins_taken)


n = int(input())
s = list(map(int, input().split()))
s.sort(reverse=True)
sn = sum(s)
kn = sn // 2
m = 0
ans = 0
for i in range(n - 1):
	m += s[i]
	if m > kn:
		ans = i + 1
		break
else:
	ans = n
print(ans)


from sys import stdin

def nmon(lista, mi):
	m = 1
	s = 0
	for i in range(len(lista)):
		s += lista[i]
		if s <= mi:
			m += 1
		else:
			m = m
	return m

def bbs(lista, n):
	for i in range(n):
		for j in range(n - 1):
			if lista[j] < lista[j + 1]:
				a = lista[j]
				lista[j] = lista[j + 1]
				lista[j + 1] = a
	return lista

def main():
	n = int(stdin.readline().strip())
	l = stdin.readline().strip().split()
	for i in range(n):
		l[i] = int(l[i])
	l = bbs(l, n)
	m = 0
	for i in range(n):
		m += l[i]
	m = m // 2
	mon = nmon(l, m)
	print(mon)
main()


n = int(input())
m = list(map(int, input().split()))
m.sort(reverse=True)
summ = sum(m)
i = 0
t = 0
while t <= summ - t:
	t += m[i]
	i += 1
print(i)


n = int(input())
li = list(map(int, input().split()))
s = sum(li)
li.sort()
tbg = s // 2
i = -1
ts = 0
while ts <= tbg:
	ts += li[i]
	i = i - 1
print(-i - 1)


def twins(coins):
	coins = sorted(coins)
	limit = sum(coins) / 2
	sum_coins = 0
	i = 0
	for coin in coins[::-1]:
		if sum_coins <= limit:
			i += 1
			sum_coins += coin
		else:
			break
	return i
a = input()
print(twins([*map(int, input().split(' '))]))


n = int(input())
a = list(map(int, input().split()))
total = sum(a) / 2
a.sort(reverse=True)
money = 0
ans = 0
i = 0
while money <= total:
	ans += 1
	money += a[i]
	i += 1
print(ans)


ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
si = lambda : input()
n = ii()
l = sorted(li(), reverse=True)
s = sum(l)
a = b = 0
for i in l:
	if s >= a:
		b += 1
		a += i
		s -= i
	else:
		break
print(b)


try:
	n = int(input())
	ls = list(map(int, input().split()))
	ls.sort()
	ls.reverse()
	for i in range(n):
		ls2 = [ls[x] for x in range(i + 1)]
		if sum(ls2) > sum(ls) - sum(ls2):
			print(i + 1)
			break
	pass
except Exception:
	pass


def listsum(numList):
	theSum = 0
	for i in numList:
		theSum = theSum + i
	return theSum
n = int(input())
a = [int(x) for x in input().split()]
a.sort()
x = []
sum = listsum(a) / 2
for i in range(n):
	if listsum(x) <= sum:
		x.append(a.pop())
	else:
		break
print(len(x))


def sum(a):
	s = 0
	for i in a:
		s += i
	return s
n = int(input())
a = list(map(int, input().split()))
k = sum(a) // 2 + 1
i = len(a) - 1
a.sort()
x = 0
while k > 0:
	x += 1
	k -= a[i]
	i -= 1
print(x)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
b = [0] * len(a)
b[0] = a[0]
for i in range(1, len(a)):
	b[i] = b[i - 1] + a[i]
sum = b[len(b) - 1]
ans = 0
for i in range(len(b) - 1):
	if sum - b[len(b) - i - 2] > b[len(b) - i - 2]:
		ans = i + 1
		break
if ans == 0:
	print(n)
else:
	print(ans)


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

def mergeSort(a, l, r):
	mid = (r + l) // 2
	if r - l > 1:
		mergeSort(a, l, mid)
		mergeSort(a, mid + 1, r)
	ptr1 = l
	ptr2 = mid + 1
	cnt = 0
	temp = []
	for i in range(r - l + 1):
		if ptr2 > r:
			temp.append(a[ptr1])
			ptr1 += 1
		elif ptr1 > mid:
			temp.append(a[ptr2])
			ptr2 += 1
		elif a[ptr2] < a[ptr1]:
			temp.append(a[ptr2])
			ptr2 += 1
		else:
			temp.append(a[ptr1])
			ptr1 += 1
	for i in range(r - l + 1):
		a[i + l] = temp[i]
	temp = []
mergeSort(a, 0, len(a) - 1)
s = sum(a)
cnt = 0
cur = 0
for i in range(n - 1, -1, -1):
	cur += a[i]
	cnt += 1
	if 2 * cur > s:
		break
print(cnt)


n = int(input())
m = [str(i) for i in sorted([int(i) for i in input().split(' ')])]
mn = eval('+'.join(m))
for i in range(len(m) + 1):
	s2 = '+'.join(m[:len(m) - i - 1])
	s1 = '+'.join(m[len(m) - i - 1:])
	if s1 == '':
		s1 = '0'
	if s2 == '':
		s2 = '0'
	if eval(s1) > eval(s2):
		mn = mn if mn < len(s1.split('+')) else len(s1.split('+')) if i else mn
print(mn)


n = int(input())
l = [int(i) for i in input().split()]
l.sort()
l.reverse()
a = 0
b = sum(l)
for i in range(0, len(l)):
	a += l[i]
	b -= l[i]
	if a > b:
		print(i + 1)
		break


n = int(input())
k = sorted(list(map(int, input().split())))
l = 0
p = 0
while l <= sum(k):
	l += k.pop()
	p += 1
print(p)


m = int(input())
n = list(map(int, input().split()))
n.sort()
n = n[::-1]
count = 0
a = sum(n)
for b in range(m):
	count += n[b]
	if a // 2 < count:
		print(b + 1)
		break


def calculateHalf(coinList):
	the_sum = 0
	for item in coinList:
		the_sum += item
	return the_sum / 2

def createCoinList(coinString):
	coinStringClean = coinString.split('\n')[0]
	coinList = coinStringClean.split(' ')
	outputCoins = []
	for item in coinList:
		outputCoins.append(int(item))
	return outputCoins

def selection_sort(the_array):
	for k in range(len(the_array) - 1):
		minimum = k
		for j in range(k, len(the_array)):
			if the_array[j] > the_array[minimum]:
				minimum = j
		swap(the_array, minimum, k)

def findMinNumber(coinList, mid):
	if mid == 0:
		return 0
	the_sum = 0
	number = 0
	while mid >= the_sum:
		the_sum += coinList[number]
		number += 1
	return number

def swap(the_array, a, b):
	temp = the_array[a]
	the_array[a] = the_array[b]
	the_array[b] = temp
numberOfCoins = int(input())
coinString = input()
coinList = createCoinList(coinString)
selection_sort(coinList)
midpoint = calculateHalf(coinList)
print(findMinNumber(coinList, midpoint))


def bubbleSort(arr):
	n = len(arr)
	for i in range(n - 1):
		for j in range(0, n - i - 1):
			if arr[j] < arr[j + 1]:
				(arr[j], arr[j + 1]) = (arr[j + 1], arr[j])
n = int(input())
arr = list(map(int, input().split()))
bubbleSort(arr)
coin = 0
mine = 0
his = 0
for i in arr:
	his += i
for i in arr:
	if mine > his:
		break
	mine += i
	his -= i
	coin += 1
print(coin)


n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
count_me = 0
summa = 0
condition_1 = 0
condition_2 = 0
for i in range(n):
	count_me += 1
	summa += a[i]
	if sum(a[i + 1:]) < summa:
		break
print(count_me)


n = int(input())
l = list(map(int, input().split()))
l = sorted(l, reverse=True)
sum1 = 0
sum2 = sum(l) / 2
for i in range(n):
	sum1 += l[i]
	if sum1 > sum2:
		print(i + 1)
		exit()


n = int(input())
a = [int(i) for i in input().split()]
s = 0
k = 0
while s <= sum(a):
	m = max(a)
	s += m
	k += 1
	a.remove(m)
print(k)


n = int(input())
coins = [x for x in map(int, input().split())]
cnt = 0
ys = 0
s = sum(coins)
coins.sort()
for i in coins[::-1]:
	if ys <= s:
		cnt += 1
		ys += i
		s -= i
print(cnt)


int(input())
k = list(map(int, input().split()))
k = sorted(k)
k.reverse()
c = 0
i = 0
e = 0
while c <= sum(k):
	c = c + k[i]
	k.pop(i)
	e = e + 1
print(e)


n = input()
numbers = list(map(int, input().split()))
numbers.sort()
total = sum(numbers)
i = 0
removed = 0
coins_they_have = 0
coins_we_have = len(numbers)
while total - removed > removed:
	removed += numbers[i]
	i += 1
	coins_they_have += 1
	coins_we_have -= 1
coins_they_have -= 1
coins_we_have += 1
print(coins_we_have)


a = int(input())
n = input()
n = n.split()
he = 0
wode = 0
for i in range(a):
	n[i] = int(n[i])
	he = he + int(n[i])
t = 0
p = sorted(n)
f = p[::-1]
while t < a:
	wode = int(f[t]) + wode
	t = t + 1
	if wode * 2 > he:
		break
print(t)


num = int(input())
lst = [int(numeric_string) for numeric_string in input('').split(' ')]
lst.sort()
cur_sum = 0
cur_coins = 0
for i in range(num - 1, -1, -1):
	cur_sum += lst[i]
	cur_coins += 1
	if cur_sum > sum(lst[0:i]):
		print(cur_coins)
		exit(0)


i = lambda : map(int, input().split())
i()
a = sorted(i())[::-1]
s = sum(a)
r = x = 0
while x <= s // 2:
	x += a[r]
	r += 1
print(r)


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
a.reverse()
i = 0
p = 0
b = 0
for w in a:
	b += w
while i <= len(a) - 1:
	p += a[i]
	if p > b - p:
		print(i + 1)
		break
	i += 1


T = int(input())
l = list(map(int, input().split()))
l.sort()
l.reverse()
a = 0
while sum(l[a:]) >= sum(l[:a]):
	a += 1
print(a)


a = input()
value = sorted(list(map(int, input().split())), reverse=True)
sum_v = sum(value)
num = 0
val = 0
for v in value:
	if val <= sum_v / 2:
		val += v
		num += 1
print(num)


n = int(input())
listt = input().split()
sum = 0
sum1 = 0
answer = 0
for i in range(n):
	listt[i] = int(listt[i])
	sum += listt[i]
listt.sort()
for i in range(n - 1, -1, -1):
	sum1 += listt[i]
	answer += 1
	if sum1 > sum - sum1:
		print(answer)
		break


def num_taken():
	coins = sorted([int(x) for x in input().strip().split()], reverse=True)
	for i in range(len(coins) + 1):
		if sum(coins[:i]) > sum(coins[i:]):
			return i
input()
print(num_taken())


l = int(input())
data = input()
data = data.split()
data = [int(x) for x in data]
data.sort()
key = True
for i in range(l - 1):
	if sum(data[:l - i - 1]) < sum(data[l - i - 1:]):
		print(i + 1)
		key = False
		break
if key:
	for i in range(l - 1):
		if sum(data[:l - i - 1]) == sum(data[l - i - 1:]):
			print(i + 1 + 1)
			key = False
			break
if l == 1:
	print(1)


line1 = input()
line2 = input()
nCoins = line1
vCoins = line2.split(' ')
arrCoins = list(map(int, vCoins))
total = 0
for x in vCoins:
	total += int(x)
arrCoins.sort(reverse=True)
minCoins = 0
minVal = total / 2
taken = 0
for x in arrCoins:
	minCoins += 1
	taken += x
	if taken > minVal:
		break
print(minCoins)


n = int(input())
coins = input().split()
coins = [int(x) for x in coins]
coins.sort(reverse=True)
coins_taken = []
while True:
	coins_taken.extend([coins[0]])
	del coins[0]
	sumOfCoinsTaken = sum(coins_taken)
	sumOfCoins = sum(coins)
	if sumOfCoinsTaken > sumOfCoins:
		break
	else:
		continue
print(len(coins_taken))


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
a.reverse()
total = 0
count = 0
while total <= sum(a):
	total += a[0]
	a.remove(a[0])
	count += 1
print(count)


n = int(input())
arr = list(map(int, input().split(' ')))
arr.sort(reverse=True)

def func():
	ctr = 0
	minCoins = 0
	for i in arr:
		minCoins += i
		if minCoins > sum(arr) - minCoins:
			ctr += 1
			return ctr
		ctr += 1
	return ctr
print(func())


input()
a = sorted(map(int, input().split()), reverse=True)
print(min((i for i in range(len(a) + 1) if sum(a[:i]) > sum(a[i:]))))


n = int(input())
Coins = input().split()
Coins = [int(i) for i in Coins]
Coins.sort()
i = len(Coins)
suma = sum(Coins)
x = Coins[i - 1]
j = 1
k = 1
while x <= suma - x:
	j = j + 1
	x = x + Coins[i - j]
	k = k + 1
print(k)


n = int(input())
d = list(map(int, input().split()))
d.sort(reverse=True)
(s1, s2) = (0, sum(d))
x = 0
while s2 >= s1:
	s1 += d[x]
	s2 -= d[x]
	x += 1
print(x)


from collections import deque
import math
n = int(input())
coins = input().split()
sumAll = 0
sumMe = 0
answer = 0
for i in range(n):
	coins[i] = int(coins[i])
	sumAll += coins[i]
coins.sort()
coins = coins[::-1]
for i in range(n):
	sumMe += coins[i]
	sumAll -= coins[i]
	answer += 1
	if sumMe > sumAll:
		break
print(answer)


no_coins = int(input())
coins = sorted(list(map(int, input().split())), reverse=True)
your_sum = 0
for i in range(no_coins):
	your_sum += coins[i]
	if your_sum > sum(coins) // 2:
		print(i + 1)
		break


n = int(input())
coins = list(map(int, input().split()))
amount = sum(coins)
coins.sort()
my_coin = 0
my_amount = 0
i = n - 1
while i >= 0:
	my_coin += 1
	my_amount += coins[i]
	amount -= coins[i]
	i -= 1
	if my_amount > amount:
		break
print(my_coin)


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


n = int(input())
li = list(map(int, input().split()))
li.sort()
li = li[::-1]
cn = 0
sm = 0
for i in range(n):
	if sm > sum(li[i:]):
		print(cn)
		exit(0)
	else:
		cn += 1
		sm += li[i]
print(cn)


n = input()
a = [int(x) for x in input().split()]
a.sort()
i = len(a) - 1
s = sum(a)
half = s / 2
while s >= half:
	s -= a[i]
	i -= 1
print(len(a) - 1 - i)


n = int(input())
S = input()
Numbers = list(map(int, S.split(' ')))
total = sum(Numbers)
Numbers.sort(reverse=True)
count = 0
share = 0
for i in range(0, n):
	share = share + Numbers[i]
	if share > total / 2:
		count = count + 1
		break
	else:
		count = count + 1
print(count)


from math import ceil, sqrt, gcd

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

def si():
	return input()

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

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


N = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
sumlist = [coins[0]]
for i in range(1, N):
	sumlist.append(sumlist[-1] + coins[i])
for i in range(0, N):
	if sumlist[i] > sumlist[-1] - sumlist[i]:
		print(i + 1)
		break


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
token = 0
coinNumbers = 0
Sum = 0
for i in range(0, len(coins)):
	Sum += coins[i]
for i in range(0, len(coins)):
	if token > Sum / 2:
		break
	coinNumbers += 1
	token += coins[i]
print(coinNumbers)


n = eval(input())
a = input().split()
l = []
i = 0
while i < n:
	l = l + [eval(a[i])]
	i += 1
i = 1
l = sorted(l, key=int)
suum = 0
c = 0
while suum <= sum(l) - suum and i <= n:
	suum += l[n - i]
	c += 1
	i += 1
print(c)


from sys import stdin

def main():
	stdin.readline()
	l = list(map(int, stdin.readline().split()))
	l.sort(reverse=True)
	x = sum(l) // 2
	for (i, y) in enumerate(l):
		x -= y
		if x < 0:
			print(i + 1)
			return
main()


s = input()
s = input()
s = s.split()
s = list(map(int, s))
SUM = sum(s)
s.sort(reverse=True)
t = 0
ans = 0
for i in s:
	t = t + i
	ans = ans + 1
	if t > SUM / 2:
		break
print(ans)


n = int(input())
p = list(map(int, input().split()))
for i in range(len(p) - 1):
	for j in range(len(p) - 1):
		if p[j] < p[j + 1]:
			t = p[j]
			p[j] = p[j + 1]
			p[j + 1] = t
s = 0
for i in range(len(p)):
	s = s + p[i]
k = s / 2
s = 0
for i in range(len(p)):
	s = s + p[i]
	if s > k:
		break
print(i + 1)


n = int(input())
coins = [int(i) for i in input().split()]
c = 0
s = 0
for i in sorted(coins, reverse=True):
	if s > sum(coins) - s:
		break
	else:
		s += i
		c += 1
print(c)


n = int(input())
a = [int(i) for i in input().split()][:n]
a.sort()
s = 0
e = 0
for i in a:
	s = s + i
s = s / 2
for i in range(n - 1, -1, -1):
	e = e + a[i]
	if e > s:
		break
print(n - i)


n = int(input())
a = map(int, input().split())
l = list(a)
s = sum(l)
le = len(l)
i = le - 1
ans = 0
f = 0
l.sort()
while f == 0 or (i >= 0 and s / f >= 2):
	f += l[i]
	ans += 1
	i -= 1
print(ans)


number = int(input())
value = list(map(int, input().split()))
avg_totalvalue = sum(value) / 2
coin = 0
value.sort(reverse=True)
value_me = 0
for i in value:
	if value_me <= avg_totalvalue:
		value_me += i
		coin += 1
	else:
		break
print(coin)


n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
s = sum(a)
ans = 0
c = 0
while ans <= s:
	ans += a[c]
	s -= a[c]
	c += 1
print(c)


T = int(input())
c = list(map(int, input().split()))
c.sort(reverse=True)
for i in range(len(c) + 1):
	if sum(c[:i]) > sum(c[i:]):
		print(i)
		break


n = int(input())
l = [int(i) for i in input().split()]
l.sort(reverse=True)
halfsum = sum(l) / 2
mysum = 0
count = 0
for i in range(n):
	mysum += l[i]
	count += 1
	if mysum > halfsum:
		print(count)
		break


_ = input()
nums = sorted(map(int, input().split()), reverse=True)
half = sum(nums) // 2
acum = 0
for (coin, num) in enumerate(nums, start=1):
	acum += num
	if acum > half:
		print(coin)
		break


x = input()
y = list(map(int, input().split()))
half = sum(y) / 2
coins = 0
quantity = 0
test = sorted(y)[::-1]
for item in test:
	quantity += item
	coins += 1
	if quantity > half:
		break
print(coins)


a = int(input())
moedas = list(map(int, input().split()))
moedas.sort()
moedas1 = sorted(moedas, key=int, reverse=True)
metade = sum(moedas) / 2
divisa = 0
dv = 0
i = 0
for j in range(a):
	if moedas[j] > metade:
		dv = 1
	elif divisa <= metade:
		divisa += moedas1[j]
		dv += 1
print(dv)


from functools import reduce
import math
n = int(input())
string = input()
arr = string.split(' ')
coins = list(map(lambda x: int(x), arr))
coins.sort()
coins.reverse()
sum = reduce(lambda x, y: x + y, coins)
half = int(math.floor(sum / 2))
count = 0
keep = 0
for i in range(n):
	keep += coins[i]
	count += 1
	if keep > half:
		break
print(count)


n = int(input())
lst = list(map(int, input().split()))
count = 0
lst = sorted(lst, reverse=True)
for i in range(len(lst)):
	if sum(lst[0:i + 1]) > sum(lst[i + 1:]):
		count += 1
		break
	else:
		count += 1
print(count)


a = int(input())
c = list(map(int, input().strip().split()))
new = []
for i in range(a):
	new.append(max(c))
	c.pop(c.index(max(c)))
	if sum(new) > sum(c):
		break
print(len(new))


def twins():
	n_coins = int(input())
	coins = str(input()).split()
	coins = sorted([int(i) for i in coins], reverse=True)
	total_sum = sum(coins)
	my_sum = 0
	my_coins = 0
	while my_sum <= total_sum / 2:
		my_sum += coins[my_coins]
		my_coins += 1
	print(my_coins)
twins()


n = int(input())
a = sorted(list(map(int, input().split())))
a.reverse()
if n == 1:
	print(1)
elif n == 2:
	if a[0] == a[1]:
		print(2)
	else:
		print(1)
else:
	b = []
	s1 = 0
	for i in range(len(a) - 1):
		s1 += a[i]
		b.append(a[i])
		s2 = 0
		for j in range(i + 1, len(a)):
			s2 += a[j]
		if s1 > s2:
			break
	print(len(b))


from math import ceil
import sys, bisect, copyreg, copy, statistics, os

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

def IIX():
	return (int(x) for x in sys.stdin.readline().split())

def II():
	return int(inp())

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

def L(x):
	return list(x)

def out(var):
	return sys.stdout.write(str(var))
n = II()
coins = LI()
coins = sorted(coins, reverse=True)
mySum = 0
for i in range(n):
	mySum += coins[i]
	if mySum > sum(coins[i + 1:]):
		out(i + 1)
		break


value_sum = 0
i = 0
n_coin = int(input())
value_coin = sorted(list(map(int, input().split())), reverse=True)
while i in range(n_coin):
	value_sum += value_coin[i]
	if value_sum * 2 > sum(value_coin):
		break
	else:
		i += 1
print(i + 1)


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


n = int(input())
li = list(map(int, input().split()))[:n]
li.sort()
mypart = 0
count = 0
sumoflist = sum(li)
for i in range(len(li) - 1, -1, -1):
	if sumoflist - mypart >= mypart:
		mypart += li[i]
		count += 1
print(count)


n = int(input())
arr = sorted(list(map(int, input().split())))
sum1 = sum(arr)
sum2 = 0
coin = 0
for i in range(n - 1, -1, -1):
	if sum2 > sum1:
		coin = n - i - 1
		break
	sum1 -= arr[i]
	sum2 += arr[i]
if coin == 0:
	coin = n
print(coin)


a = int(input())
n = sorted(list(map(int, input().split())), reverse=True)
v = []
c = []
s = 1
for i in range(len(n)):
	v.append(n[i])
	c = n[i + 1:]
	if sum(v) > sum(c):
		break
	s += 1
print(s)


monedas = int(input())
valores = input()
valores = valores.split()
Arreglo = []
parte = 0
for k in valores:
	Arreglo.append(int(k))
	parte += int(k)
for i in range(1, monedas):
	while i > 0 and Arreglo[i] < Arreglo[i - 1]:
		primero = Arreglo[i]
		Arreglo[i] = Arreglo[i - 1]
		Arreglo[i - 1] = primero
		i -= 1
parte /= 2
gemelo = 0
for i in range(1, monedas + 1):
	gemelo += Arreglo[monedas - i]
	if gemelo > parte:
		print(i)
		break


from math import *
lst = []
x = int(input())
lst = list(map(int, input().split()))
lst.sort()
sum = 0
for i in range(x):
	sum = sum + lst[i]
sum = sum / 2
sum1 = 0
count = 0
i = x - 1
while i >= 0:
	if sum1 > sum:
		break
	sum1 = sum1 + lst[i]
	count = count + 1
	i -= 1
print(count)


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


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()
coins = []
for i in range(N):
	coins.append(get_number())
coins.sort()
tot = sum(coins)
temp_sum = 0
count = 0
for i in range(N - 1, -1, -1):
	temp_sum += coins[i]
	count += 1
	if temp_sum > tot / 2:
		break
print(count)


n = int(input())
c = list(map(int, input().split()))
p = sum(c) // 2
c.sort()
c = c[::-1]
m = 0
k = 0
for i in c:
	if m > p:
		break
	else:
		m += i
		k += 1
print(k)


size = int(input())
arr = [int(i) for i in input().split()]
arr.sort()
news = []
answer = 0
while len(arr) >= 1:
	news.append(arr[len(arr) - 1])
	arr.remove(arr[len(arr) - 1])
	answer += 1
	if sum(news) > sum(arr):
		break
print(answer)


n = int(input().strip())
s = input().strip()
l = list((int(x) for x in s.split(' ')))
l.sort(reverse=True)
t1 = 0
t2 = 0
c = 0
for i in l:
	t1 += i
for i in l:
	t2 += i
	t1 -= i
	c += 1
	if t2 > t1:
		break
print(c)


n = int(input())
n1 = list(map(int, input().split()))
n2 = sum(n1) // 2
s = nu = nu1 = 0
for i in sorted(n1, reverse=True):
	s = s + i
	nu1 = nu1 + 1
	if s > n2:
		break
print(nu1)


n = int(input())
l = list(map(int, input().split()))
l = sorted(l, reverse=True)
for x in range(len(l)):
	if sum(l[:x]) > sum(l[x:]):
		print(x)
		break
else:
	print(len(l))


__author__ = 'Bian'
n = int(input())
data = [int(x) for x in input().split()]
data.sort()
satisfy = sum(data) / 2
current = 0
for i in range(len(data) - 1, -1, -1):
	current += data[i]
	if current > satisfy:
		print(len(data) - i)
		break


n = int(input())
m = []
for i in str(input()).split():
	m.append(int(i))
m.sort()
m.reverse()
sum = 0
for i in m:
	sum += int(i)
s = 0
t = 0
while s <= sum // 2:
	s += int(m[t])
	t += 1
print(t)


n = int(input())
coins = list(reversed(sorted([int(x) for x in input().split(' ')])))
totalValue = sum(coins)
coinTaken = 0
takenValue = 0
for i in range(n):
	coinTaken += 1
	takenValue += coins[i]
	if takenValue > totalValue - takenValue:
		break
print(coinTaken)


def sums(l):
	s = 0
	for i in l:
		s = s + i
	return s
n = int(input())
val = list(map(int, input().split(' ')))
val_sort = sorted(val, reverse=True)
sum1 = 0
final = [0]
for i in range(n):
	check = sums(val_sort[i:n])
	if sums(final) <= check:
		final.append(val_sort[i])
print(len(final[1:]))


n = int(input().rstrip())
coins = list(map(int, input().rstrip().split()))
coins = sorted(coins, reverse=True)
equal_dis = sum(coins) / 2
taken = 0
count = 0
while not taken > equal_dis and count < n:
	taken += coins[count]
	count += 1
print(count)


coin = int(input())
valist = [int(x) for x in input().split()]
valist.sort(reverse=True)
money = 0
allmoney = sum(valist)
for i in range(len(valist)):
	money += valist[i]
	if 2 * money > allmoney:
		print(i + 1)
		break


import math
n = int(input())
a = [0 for i in range(n)]
s = 0
a = list(map(int, input().split()))
a = sorted(a)
for i in range(n):
	s = s + a[i]
k = 0
d = 0
for i in range(n - 1, -1, -1):
	d = d + a[i]
	k = k + 1
	if d > math.floor(s / 2):
		break
print(k)


coins = input()
values = input()
values = values.split(' ')
sum = 0
for k in values:
	sum += int(k)
count = 0
value = 0
for k in range(len(values)):
	max = k
	for j in range(k + 1, len(values)):
		if int(values[j]) > int(values[max]):
			max = j
	(values[max], values[k]) = (values[k], values[max])
	value += int(values[k])
	count += 1
	if value > sum - value:
		break
print(count)


n = int(input())
coins = list(map(int, input().split()))
c = 0
if n > 2:
	coins.sort()
	for i in range(1, n):
		if sum(coins[:n - i]) >= sum(coins[n - i:n]):
			pass
		else:
			c = i
			break
elif n == 1:
	c = 1
elif coins[0] > coins[1]:
	c = 1
else:
	c = 2
print(c)


import array
n = int(input())
val = 0
arr = list(map(int, input().split()))
tot = sum(arr)
mine = 0
o = 0
arr.sort(reverse=True)
while mine <= tot / 2:
	mine += arr[o]
	o += 1
print(o)


n = int(input())
L = sorted(list(map(int, input().split())))[::-1]
suma = 0
cont = 0
for k in range(n):
	suma += L[k]
	cont += 1
	if suma > sum(L[k + 1:]):
		break
print(cont)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
i = 1
while sum(a[:i]) <= sum(a[i:]):
	i += 1
print(i)


def twins(n, arr):
	max = 0
	result = 0
	cnt = 0
	for a in arr:
		max += a
	mid = int(max / 2)
	for a in range(0, len(arr)):
		for b in range(0, len(arr)):
			if arr[a] > arr[b]:
				arr[a] = arr[a] + arr[b]
				arr[b] = arr[a] - arr[b]
				arr[a] = arr[a] - arr[b]
	for a in arr:
		if result <= int(mid):
			result += a
			cnt += 1
	print(cnt)
twins(input(), list(map(int, input().split())))


n = int(input())
line2 = input().split(' ')
numbers = []
total = 0
my_sum = 0
for i in line2:
	x = int(i)
	numbers.append(x)
	total += x
numbers.sort(reverse=True)
for i in range(0, n):
	x = numbers[i]
	my_sum += x
	total -= x
	if my_sum > total:
		break
print(i + 1)


i = 1
input()
money = sorted(map(int, input().split()))[::-1]
while 1:
	if sum(money[:i]) > sum(money[i:]):
		print(i)
		exit()
	else:
		i += 1


n = int(input())
a = input()
a = [int(x) for x in a.split()]
kol = 0
d = 0
for i in range(n):
	c = max(a)
	d = d + c
	a.remove(c)
	b = sum(a)
	kol += 1
	if b < d:
		print(kol)
		break


input()
l = list(map(lambda x: int(x), input().split()))
l.sort(reverse=True)
s = 0
for (i, x) in enumerate(l):
	s += x
	if s > float(sum(l)) / 2.0:
		print(i + 1)
		break


a = int(input())
p = []
n = input().split(' ')
for i in range(a):
	p.append(int(n[i]))
p.sort(reverse=True)
b = sum(p)
c = 0
n = 0
for i in range(a):
	c = c + p[i]
	n = n + 1
	if c > b / 2:
		break
print(n)


n = int(input())
nums = input().split()
lst = []
total = 0
for i in range(0, n):
	lst.append(int(nums[i]))
	total = total + lst[i]
lst.sort()
lst.reverse()
accum = 0
for i in range(0, n):
	accum = accum + lst[i]
	if accum > total - accum:
		print(i + 1)
		break


inn = []
ans = 0
sum = 0
n = int(input())
inn = input().split()
inn = [int(m) for m in inn]
for i in range(0, len(inn)):
	sum = sum + inn[i]
inn[0:len(inn)] = sorted(inn[0:len(inn)], reverse=True)
i = 0
temp = 0
while i < len(inn) and temp <= sum / 2:
	temp = temp + inn[i]
	ans = ans + 1
	i = i + 1
print(ans)


n = int(input())
list1 = list(map(int, input().split(' ')))
list1.sort()
list1.reverse()
sum1 = 0
num = 0
count = 0
for i in list1:
	sum1 = sum1 + i
for i in list1:
	count = count + i
	num = num + 1
	sum1 = sum1 - i
	if count > sum1:
		break
print(num)


def twin(n, arr):
	arr.sort()
	t = 0
	for i in range(n):
		t += arr[i]
	j = n - 1
	c = 0
	while j >= 0:
		c += arr[j]
		if c * 2 > t:
			return n - j
		j -= 1
	return c
a = int(input())
b = list(map(int, input().strip().split()))
print(twin(a, b))


n = int(input())
a = list(map(int, input().split()))
a.sort()
count = 0
num = sum(a) // 2
s = 0
while s <= num:
	s += a[n - count - 1]
	count += 1
print(count)


num = input()
value = list(map(int, input().split()))
value.sort(reverse=True)
num = []
sum1 = sum(value) / 2
sum2 = 0
for i in value:
	sum2 += i
	num.append(i)
	if sum2 > sum1:
		break
print(len(num))


n = eval(input())
l1 = list(map(eval, input().split()))
p = 0
i = 0
while p <= sum(l1):
	p = p + max(l1)
	l1.remove(max(l1))
	i += 1
print(i)


n = int(input())
l = list(map(int, input().split()))
a = sum(l) / 2
s = sorted(l)
x = len(l)
for i in range(1, len(s)):
	if sum(s[-i:]) > a:
		x = i
		break
print(x)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
x = sum(a)
su = 0
coins = 0
for i in a:
	if su > x - su:
		break
	su += i
	coins += 1
print(coins)


n = int(input())
c = list(map(int, input().split()))
c.sort()
s = sum(c)
s2 = 0
ans = 0
while len(c) > 0 and s2 <= s:
	x = c.pop()
	s2 += x
	s -= x
	ans += 1
print(ans)


n = int(input())
arr = input().split()
for i in range(0, n):
	arr[i] = int(arr[i])
arr.sort()
minCoin = 1
rightSum = int(arr[-1])
leftSum = sum(arr) - int(arr[-1])
for i in range(0, n - 1):
	if leftSum < rightSum:
		break
	else:
		minCoin += 1
		rightSum += arr[n - 2 - i]
		leftSum -= arr[n - 2 - i]
print(minCoin)


n = int(input())
l = []
l = input().split(' ')
for i in range(len(l)):
	l[i] = int(l[i])
l.sort(reverse=True)
sum = 0
for i in range(len(l)):
	sum += int(l[i])
sum /= 2
tsum = 0
coinnum = 0
for j in range(len(l)):
	tsum += int(l[j])
	if tsum > sum:
		coinnum = j + 1
		break
	else:
		pass
print(coinnum)


n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
sum1 = 0
sum2 = sum(a)
while sum2 >= sum1:
	sum1 += a.pop(0)
	sum2 = sum(a)
print(n - len(a))


number_of_coins = int(input(''))
l = [int(i) for i in input('').split(' ')]
l.sort()
i = 0
l = l[::-1]
while i != len(l):
	if sum(l[0:i + 1]) > sum(l[i + 1:]):
		i += 1
		break
	i += 1
print(i)


from itertools import accumulate

def rs():
	return input().rstrip()

def ri():
	return int(rs())

def ra():
	return list(map(int, rs().split()))
n = ri()
arr = ra()
arr.sort(reverse=True)
acc1 = list(accumulate(arr))
arr.reverse()
acc2 = list(accumulate(arr))
acc2.reverse()
acc2.pop(0)
for (num, uwu) in enumerate(zip(acc1, acc2)):
	(a, b) = uwu
	if a > b:
		print(num + 1)
		break
else:
	print(n)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
s = sum(a)
money = 0
number = 0
for m in a:
	if money - m <= s - m:
		money = money + m
		s = s - m
		number = number + 1
print(number)


def minimum_comprehension(coins):
	list.sort(coins, reverse=True)
	return len(min([coins[:n] for n in range(len(coins) + 1) if sum(coins[:n]) > sum(coins[n:])], key=len))
coins_number = int(input())
coins = [n for n in map(int, input().split())]
print(minimum_comprehension(coins))


n = int(input())
coins = [int(x) for x in input().split()]
half = sum(coins) // 2
sum = 0
num = 0
coins.sort()
coins.reverse()
for a in coins:
	if sum <= half:
		num += 1
		sum += a
		continue
	else:
		break
print(num)


input()
arr = list(map(int, input().split()))
arr.sort(reverse=True)
total = sum(arr)
curr = 0
ptr = 0
for val in arr:
	curr += val
	ptr += 1
	if curr > total - curr:
		break
print(ptr)


a = int(input())
b = list(map(int, input().split()))
t = 0
x = 0
c = sum(b)
d = sorted(b)
while t <= c / 2:
	t += d[len(d) - x - 1]
	x += 1
print(x)


n = int(input())
a = list(map(int, input().split()))
S = 0
for x in a:
	S += x
a.sort()
a.reverse()
taken = 0
ans = 0
for x in a:
	if taken > S:
		break
	taken += x
	S -= x
	ans += 1
print(ans)


from sys import stdin, stdout
N = int(stdin.readline())
A = list(map(int, stdin.readline().split()))
A.sort(reverse=True)
sum_A = A[0]
sum_B = sum(A[1:])
count_A = 1
count_B = N - 1
i = 1
while sum_A <= sum_B and i < N:
	sum_A += A[i]
	sum_B -= A[i]
	count_A += 1
	count_B -= 1
	i += 1
stdout.write(str(count_A))


n = int(input())
a = list(map(int, input().split()))[:n]
s = 0
c = 0
count = 0
for i in range(0, n):
	s = s + max(a)
	a.remove(max(a))
	count += 1
	if s > sum(a):
		break
if s > c:
	print(count)


n = int(input())
a = input().split()
sum = 0
for _ in a:
	sum = sum + int(_)
for _ in range(n):
	a[_] = int(a[_])
a.sort()
a.reverse()
s = 0
ans = 0
for _ in a:
	s = s + int(_)
	ans += 1
	if s > sum - s:
		print(ans)
		exit(0)


def _sum(a):
	ans = 0
	for i in a:
		ans = ans + int(i)
	return ans
n = int(input())
a = []
b = []
b = input().split()
for j in b:
	a.append(int(j))
a.sort()
a.reverse()
ls = 0
rs = _sum(a)
i = 0
while i < n and rs >= ls:
	ls += int(a[i])
	rs -= int(a[i])
	i = i + 1
print(i)


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
s = sum(l)
ss = 0
count = 0
for i in l:
	ss += i
	count += 1
	if ss > s - ss:
		print(count)
		break


noOfCoins = int(input())
valueOfEachCoin = sorted([int(x) for x in input().split(' ')], reverse=True)
for index in range(noOfCoins):
	if sum(valueOfEachCoin[0:index + 1]) > sum(valueOfEachCoin[index + 1:]):
		print(index + 1)
		break


n = int(input())
s = str(input())
test_list = s.split()
sum = 0
for i in range(0, len(test_list)):
	test_list[i] = int(test_list[i])
	sum += test_list[i]
list.sort(test_list, reverse=True)
temp = test_list[0]
for i in range(1, n + 1):
	if temp > sum - temp:
		print(i)
		break
	temp += test_list[i]


n = int(input(''))
ar = list(map(int, input().strip().split(' ')))
ar.sort()
ar.reverse()
tot = sum(ar)
tot = tot / 2
count = 0
i = 0
while tot >= count:
	count = count + ar[i]
	i = i + 1
print(i)


import sys
from random import choice, randint
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 MI():
	return map(int, sys.stdin.readline().strip().split())

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

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]

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

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

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

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

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

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

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

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))
inp = sys.stdin.readline
out = sys.stdout.write

def main():
	n = I()
	a = LI()
	a.sort()
	ts = sum(a)
	(s, c) = (0, 0)
	for i in reversed(range(n)):
		s += a[i]
		c += 1
		if s > ts - s:
			break
	pf(c)
main()


import sys
input = sys.stdin.readline
n = int(input())
coins = list(map(int, input().split()))
res = []

def solve():
	coins.sort(reverse=True)
	res.append(coins.pop(0))
	if sum(res) > sum(coins):
		print(len(res))
	else:
		solve()
if n == 1:
	print(1)
else:
	solve()


def cem(massiv, i):
	(s, j) = (0, 0)
	while j <= i:
		s += massiv[j]
		j += 1
	return s
n = int(input())
c = [int(i) for i in str(input()).split()]
if n == 1:
	print(1)
else:
	c.sort()
	a = {'my': 0, 'tw': 0, 's': 1, 'j': n - 1, 'i': 0}
	j = n - 1
	i = 0
	while True:
		a['my'] += c[a['j']]
		a['tw'] = cem(c, a['j'] - 1)
		if a['my'] > a['tw']:
			break
		a['s'] = a['s'] + 1
		a['j'] = a['j'] - 1
	print(a['s'])


n = int(input())
coins = sorted(list(map(int, input().split())))
s = sum(coins)
for i in range(1, n + 1):
	if 2 * sum(coins[-1 * i:]) > s:
		print(i)
		break


n = int(input())
C = [int(x) for x in input().split(' ')]
C.sort()
sum = 0
for x in C:
	sum += x
mine_s = 0
mine_c = 0
for i in range(n):
	mine_s += C[n - 1 - i]
	mine_c += 1
	if sum - mine_s < mine_s:
		print(mine_c)
		break


n = int(input())
p = list(map(int, input().split()))
p.append(0)
l = []
for x in range(5555):
	l.append(max(p))
	p.remove(max(p))
	if sum(l) > sum(p):
		break
	else:
		pass
print(len(l))


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
cmin = 0
track = 0
total = sum(a)
min = a[-1]
for i in range(n):
	cmin += a[i]
	if cmin <= total / 2:
		track += 1
print(track + 1)


input()
a = sorted(list(map(int, input().split())))
val = ans = 0
while val <= sum(a):
	val += a.pop()
	ans += 1
print(ans)


n = int(input())
coins = sorted(list(map(int, input().split())))
coins_temp = []
for i in range(n):
	c = coins.pop()
	coins_temp.append(c)
	if sum(coins_temp) > sum(coins):
		print(i + 1)
		break


n = int(input())
c = [int(i) for i in input().split()]
total = 0
for i in range(n):
	total = total + c[i]
c.sort()
get = 0
i = n - 1
while get * 2 <= total:
	get = get + c[i]
	i -= 1
print(n - i - 1)


n = int(input())
a = list(map(int, input().split()))
a.sort()
sum = 0
for i in range(n):
	sum += a[i]
sum /= 2
cnt = 0
ans = 0
while ans <= sum:
	cnt += 1
	ans += a[n - cnt]
print(cnt)


total = 0
me = 0
twin = 0
num = 0
n = int(input())
coins = list(map(int, input().split()))
coins.sort()
coins.reverse()
for i in range(len(coins)):
	total += coins[i]
for i in range(len(coins)):
	me += coins[i]
	twin = total - me
	num += 1
	if me > twin:
		break
	else:
		pass
print(num)


def main():
	n = int(input())
	coins = [int(a) for a in input().split(' ')]
	coins.sort(reverse=True)
	for count in range(1, n + 1):
		if sum(coins[:count]) > sum(coins[count:]):
			print(count)
			return
main()


ncoins = int(input())
coins = input().split(' ')
lcoin = []
for coin in coins:
	lcoin.append(int(coin))
lcoin.sort(reverse=True)
half = sum(lcoin) / 2
count = 0
taken = 0
while taken <= half:
	taken = taken + lcoin[count]
	count = count + 1
print(count)


n = int(input())
s = [int(i) for i in input().split()]
sum = 0
for i in s:
	sum += i
sum = sum / 2
num = 0
val = 0
s.sort()
s.reverse()
for i in s:
	num += 1
	val += i
	if val > sum:
		break
print(num)


n = int(input())
values = list(map(int, input().split()))
values.sort()
values.reverse()
coins = 0
ss1 = 0
ss2 = sum(values)
i = 0
while ss1 <= ss2:
	ss1 += values[i]
	ss2 = ss2 - values[i]
	i += 1
	coins += 1
print(coins)


n = int(input())
l = list(map(int, input().split()))
s = sum(l) / 2
b = 0
c = 0
while b <= s:
	b += max(l)
	l.remove(max(l))
	c += 1
print(c)


n = int(input())
n_list = list(map(int, input().split()))
sum = 0
for i in n_list:
	sum += i
n_list.sort(reverse=True)
temp = 0
count = 0
for i in n_list:
	temp += i
	sum -= i
	count += 1
	if temp > sum:
		print(count)
		break


n = int(input())
c = [int(y) for y in input().split()]
c.sort(reverse=True)
sm = sum(c)
tot = 0
for (idx, i) in enumerate(c):
	if tot + i > sm - tot - i:
		break
	tot += i
print(idx + 1)


n = int(input())
lst = [int(x) for x in input().split()]
tot = sum(lst)
val = 0
i = 1
for x in sorted(lst, reverse=True):
	val += x
	if tot - val < val:
		break
	i += 1
print(i)


a = int(input())
x = list(map(int, input().split()))
x.sort()
x.reverse()
duit = 0
jumlah = 0
for z in range(len(x)):
	if duit > sum(x) - duit:
		break
	duit = duit + x[z]
	jumlah = jumlah + 1
print(jumlah)


x = int(input())
p = sorted(list(map(int, input().split())), reverse=True)
(n, f, s) = (0, 0, sum(p))
for i in p:
	f += i
	n += 1
	if f > s / 2:
		break
print(n)


l = int(input())
a = input()
a = a.split(' ')
b = []
c = []
e = []
d = 0
for char in a:
	l1 = len(char)
	if l1 == 1:
		b.append(char)
	elif l1 == 2:
		c.append(char)
	else:
		e.append(char)
b.sort(reverse=True)
c.sort(reverse=True)
a0 = e + c + b
s = 0
for i in range(l):
	m = int(a0[i])
	s = s + m
for i in range(l):
	m = int(a0[i])
	d = d + m
	if d > s // 2:
		print(i + 1)
		break


n = int(input())
s = sorted(map(int, input().split()), reverse=True)
t = sum(s)
r = 0
for i in range(n):
	r += s[i]
	if 2 * r > t:
		print(i + 1)
		exit(0)


length = int(input())
string = input()
lis = string.split()
sumf = 0
for i in range(length):
	lis[i] = int(lis[i])
	sumf = sumf + lis[i]
lis.sort(reverse=1)
sum = lis[0]
result = 1
for i in range(1, length):
	if sum > sumf - sum:
		break
	else:
		sum = sum + lis[i]
		result = result + 1
print(result)


n = int(input())
p = list(map(int, input().strip().split()))[:n]
p.sort()
d = 1
x = p.pop()
while 1:
	if x > sum(p):
		print(d)
		break
	else:
		d = d + 1
		x = x + p.pop()


def sum_list(list1):
	sum_l = 0
	for item in list1:
		sum_l += item
	return sum_l
n = int(input())
a = 0
coins = list(map(int, input().split()))
coins.sort()
sum = 0
if len(coins) == n:
	for i in coins[::-1]:
		a += 1
		sum += i
		coins.remove(i)
		if sum_list(coins) < sum:
			break
		else:
			continue
	print(a)


N = int(input())
List = sorted(list(map(int, input().split())))
List = List[::-1]
count = 0
if N == 1:
	print('1')
elif N == 2:
	if List[0] == List[1]:
		print('2')
	else:
		print('1')
else:
	for i in range(N):
		if sum(List[:i + 1]) > sum(List[i + 1:]):
			print(i + 1)
			break
		else:
			count += 1


s = 0
c = 0
n = int(input())
for i in range(1):
	arr = sorted(map(int, input().split()))
while s <= sum(arr):
	s = s + arr.pop()
	c += 1
print(c)


n = int(input())
coins = list(map(int, input().split()))
coins.sort()
result = 1
while sum(coins[:n - result]) >= sum(coins[n - result:]):
	result += 1
print(result)


import math
n = int(input())
a = sorted([*map(int, input().split())], reverse=True)
ans = 0
s = 0
for i in a:
	s += i
	ans += 1
	if s > sum(a) - s:
		break
print(ans)


n = int(input())
l = list(map(int, input().split()))
summation = sum(l)
l.sort(reverse=True)
summ = 0
k = 0
for i in l:
	summ += i
	k += 1
	if summ > summation / 2:
		break
print(k)


n = int(input())
x = sorted(list(map(int, input().split(' '))))
c = v = 0
while v <= sum(x):
	c += 1
	v += x.pop()
print(c)


def split(l):
	l.sort(reverse=True)
	c = 0
	res = 0
	for i in range(len(l)):
		res = res + l[i]
		c += 1
		if res > sum:
			return c
n = int(input())
l = list(map(int, input().split()))
sum = sum(l) / 2
if 0 in l:
	print('0')
else:
	print(split(l))


x = input().split()
x = int(x[0])
l = list(map(int, input().split()))
l.sort()
s = 0
for i in l:
	s = s + i
res = 0
cont = 0
for i in reversed(l):
	res = res + i
	aux = s - res
	if res > aux:
		cont = cont + 1
		break
	else:
		cont = cont + 1
print(cont)


from sys import stdin
n = int(input())
a = sorted([int(x) for x in stdin.readline().split()], reverse=True)
if len(a) == 1:
	print(1)
	exit()
if len(a) == 2 and a[0] == a[1]:
	print(2)
	exit()
for i in range(1, n):
	if sum(a[:i]) > sum(a[i:]):
		if i == 1:
			print(1)
			exit()
		elif i > 1:
			print(i)
			exit()


a = int(input())
s = input().split()
for i in range(len(s)):
	s[i] = int(s[i])
s = sorted(s, reverse=True)
t = 0
for i in range(len(s)):
	t = t + int(s[i])
l = 0
n = 0
for i in range(len(s)):
	l = l + int(s[i])
	if l > t - l:
		n = i + 1
		break
print(n)


n = int(input())
arr = [int(i) for i in input().split(' ')]
sum = 0
for i in range(n):
	sum += arr[i]
arr.sort()
arr.reverse()
(cnt, half_sum) = (0, 0)
for i in range(n):
	half_sum += arr[i]
	cnt += 1
	if half_sum > sum // 2:
		print(cnt)
		exit()


n = int(input())
coins = [int(x) for x in input().split(' ')]
cl = [0] * (n - 1)
coins.sort()
cl.insert(0, coins[0])
for x in range(1, n):
	cl[x] = cl[x - 1] + coins[x]
clr = [0] * (n - 1)
clr.insert(n - 1, coins[n - 1])
for x in range(n - 2, -1, -1):
	clr[x] = clr[x + 1] + coins[x]
index = 0
for i in range(0, n - 1):
	diff = 10000
	if cl[i] < clr[i + 1]:
		if diff > abs(cl[i] - clr[i + 1]):
			diff = abs(cl[i] - clr[i + 1])
			index = n - (i + 1)
if index == 0:
	print(n)
else:
	print(index)


input()
coins = [int(i) for i in input().split()]
coins.sort(reverse=True)
sums = 0
count = 0
for coin in coins:
	sums += coin
	count += 1
	if sums > sum(coins) / 2:
		break
print(count)


n = int(input())
coins = sorted(map(int, input().split(' ')))
greedy_twin_sum = coin_number = 0
while greedy_twin_sum <= sum(coins):
	greedy_twin_sum += coins.pop()
	coin_number += 1
print(coin_number)


n = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
ss = sum(arr)
temp = 0
for i in range(len(arr)):
	temp += arr[i]
	if temp > ss / 2:
		print(i + 1)
		exit()
print(n)


a = int(input())
k = list(map(int, input().split()))
k.sort()
k.reverse()
j = 0
y = 0
d = sum(k)
for i in k:
	j += i
	y += 1
	if d - j < j:
		break
print(y)


numberofcoins = int(input())
coinsstr = input()
coins = coinsstr.split(' ')
sorted_coins = sorted(list(map(int, coins)))
my_coins = []
my_sum = sum(my_coins)
twin_sum = sum(sorted_coins)
while my_sum <= twin_sum:
	try:
		coin = sorted_coins.pop()
		my_coins.append(coin)
	except IndexError:
		print(len(my_coins))
		exit()
	else:
		my_sum = sum(my_coins)
		twin_sum = sum(sorted_coins)
print(len(my_coins))


n = int(input())
ls = list(map(int, input().split(' ')))
tot = sum(ls)
list.sort(ls)
mine = 0
other = tot
for i in range(1, 1 + len(ls)):
	mine += ls[-i]
	other -= ls[-i]
	if mine > other:
		print(i)
		break


N = int(input())
coins = list(map(int, input().split()))
coins = sorted(coins, reverse=True)
for i in range(1, N + 1):
	ls = sum(coins[:i])
	rs = sum(coins[i:])
	if ls > rs:
		print(i)
		break


from math import *
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
ha = sum(a) / 2
temp = 0
i = 0
while temp <= ha:
	temp += a[i]
	i += 1
print(i)


n = int(input())
s = [int(i) for i in input().split()]
s.sort()
s.reverse()
first = 0
second = sum(s)
for i in range(n):
	first += s[i]
	second -= s[i]
	if first > second:
		print(i + 1)
		break


n = int(input())
list = input().split()
list = [int(x) for x in list]
list.sort()
a = sum(list) / 2
b = 0
c = 0
s = n - 1
while b <= a:
	b = b + list[s]
	s = s - 1
	c = c + 1
print(c)


import string
x = int(input())
coins = [int(i) for i in input().split()]
coins.sort(reverse=True)
for i in range(x):
	if sum(coins[:i + 1]) > sum(coins[i + 1:]):
		print(i + 1)
		break


n = int(input())
coins = list(map(int, input().split()))
coinSum = sum(coins)
coins.sort(reverse=True)
remaining = coinSum
present = 0
i = 0
while remaining >= present and i < n:
	present += coins[i]
	remaining -= coins[i]
	i += 1
print(i)


n = int(input())
nominal = input().split()
for i in range(len(nominal)):
	nominal[i] = int(nominal[i])
nominal.sort()
nominal.reverse()
for i in range(len(nominal)):
	i = i + 1
	a = nominal[0:i]
	b = nominal[i:len(nominal)]
	suma = 0
	sumb = 0
	for number in a:
		suma = suma + number
	for number in b:
		sumb = sumb + number
	if suma > sumb:
		print(len(a))
		break


n = int(input())
coins = [int(x) for x in input().split()]
total_sum = sum(coins)
count = 0
sums = 0
coins.sort(reverse=True)
for i in range(n):
	count += 1
	if sums + coins[i] > total_sum - coins[i]:
		break
	sums += coins[i]
	total_sum -= coins[i]
print(count)


n = int(input())
s = sorted(map(int, input().split(' ')), reverse=True)
cnt = 0
for i in range(n):
	cnt += s[i]
half = (cnt + 1) / 2
i = 0
while half > 0:
	half -= s[i]
	i += 1
print(i)


n = int(input())
nums = [int(x) for x in input().split()]
sorted_nums = sorted(nums, reverse=True)
tot = sum(nums)
count = 0
my_tot = 0
i = 0
while my_tot <= tot / 2:
	my_tot += sorted_nums[i]
	i += 1
	count += 1
print(count)


e = input()
l = list(map(int, input().split()))
l = sorted(l, reverse=True)
m = sum(l) // 2
s = 0
for i in range(len(l)):
	s = s + l[i]
	if s == m:
		print(i + 2)
		break
	elif s > m:
		print(i + 1)
		break


n = input()
inp = input().split()
coins = []
for i in inp:
	i = int(i)
	coins.append(i)
coins.sort()
coins.reverse()
sumCoins = 0
for i in coins:
	sumCoins += i
half = sumCoins / 2
sumCoins = 0
count = 0
for i in coins:
	if sumCoins <= half:
		sumCoins += i
		count += 1
print(count)


ignored = input()
you = [int(i) for i in input().split()]
me = []
you.sort()
you = you[::-1]
me.append(you.pop(0))
while sum(me) <= sum(you):
	me.append(you.pop(0))
print(len(me))


n = int(input())
coins = [int(x) for x in input().split()]
coins.sort(reverse=True)
total = sum(coins)
taken = 0
i = 0
while taken <= total - taken:
	taken += coins[i]
	i += 1
print(i)


n = int(input())
lis = list(map(int, input().split()))
lis.sort(reverse=True)
temp = 0
val = sum(lis)
cnt = 0
for i in lis:
	if temp <= val:
		cnt += 1
		temp += i
		val -= i
	else:
		break
print(cnt)


n = int(input())
array = list(map(int, input().split()))
max_array = [0]
min_count = 0
while sum(max_array) <= sum(array):
	max_array.append(array.pop(array.index(max(array))))
	min_count += 1
print(min_count)


n = int(input())
coins = [int(x) for x in input().split()]
twin1_sum = 0
twin2_sum = sum(coins)
coin_count = 0
sorted_list = sorted(coins, key=lambda x: -x)
for i in range(len(sorted_list)):
	twin1_sum += sorted_list[i]
	twin2_sum -= sorted_list[i]
	coin_count += 1
	if twin1_sum > twin2_sum:
		print(coin_count)
		break


n = int(input())
s = input().split()
my_list = []
for i in s:
	my_list.append(int(i))
y = sum(my_list)
count = 0
x = 0
for i in range(n):
	if sum(my_list) < y / 2:
		break
	count += 1
	x += max(my_list)
	my_list.remove(max(my_list))
print(count)


a = int(input())
bb = input().split()
bb = [int(x) for x in bb]
bb.sort()
bb.reverse()
sum0 = 0
sum1 = sum(bb)
for i in range(len(bb)):
	sum0 += bb[i]
	if sum0 > sum1 / 2:
		print(i + 1)
		break


a = int(input())
i = [int(x) for x in input().split()]
i.sort()
coin = i[::-1]
total = sum(coin)
count = 0
x = 0
for p in range(a):
	x += coin[p]
	count += 1
	if x > total - x:
		print(count)
		exit()


name = int(input())
seq = [int(x) for x in input().split()]
seq = sorted(seq, reverse=True)
mid = sum(seq) // 2 + 1
total = 0
count = 0
for val in seq:
	total += val
	count += 1
	if total >= mid:
		break
print(count)


n = int(input())
A = sorted([int(x) for x in input().split()])
B = []
for i in range(n):
	B.append(A[i])
	if sum(B) >= sum(A) / 2:
		print(n - i)
		break


from math import *
s = p = t = q = int(0)
n = int(input())
if n >= 1 and n <= 100:
	arr = list(map(int, input().split()))
	q = max(arr)
	if q >= 1 and q <= 100:
		s = ceil(sum(arr) / 2)
		if len(arr) == n:
			p = 1
		while True:
			if sum(arr) < s:
				break
			t = t + 1
			arr.pop(arr.index(max(arr)))
if p == 1:
	print(t)


c = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
my = coins[0]
co = 1
coins = coins[1:]
while my <= sum(coins):
	my += coins[0]
	coins = coins[1:]
	co += 1
print(co)


_ = input()
a = list(map(int, input().split(' ')))
a.sort()
s = sum(a) / 2
c = 0
ps = 0
for i in reversed(a):
	ps += i
	c += 1
	if ps > s:
		break
print(c)


n = int(input())
l = input().split(' ')
l = [int(s) for s in l]
l.sort()
mySum = 0
i = n - 1
nIters = 0
while i != -1:
	mySum += l[i]
	hisSum = 0
	for j in range(0, i):
		hisSum += l[j]
	i -= 1
	nIters += 1
	if mySum > hisSum:
		print(nIters)
		break


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
half = sum(l) / 2
full = sum(l)
su = 0
count = 0
for j in range(len(l)):
	su = su + l[j]
	count = count + 1
	if su > half:
		print(count)
		break


def main():
	from sys import stdout
	n = int(input())
	lis = list(map(int, input().split()))
	sum = 0
	for el in lis:
		sum += el
	money = 0
	ind = 0
	while money <= sum / 2:
		money += max(lis)
		ind += 1
		lis.remove(max(lis))
	stdout.write(str(ind))
main()


ln = input()
m = sorted([int(i) for i in input().split(' ')], reverse=True)
s = sum(m)
sum1 = 0
count = 0
for i in m:
	if sum1 > s / 2:
		break
	count += 1
	sum1 += i
print(count)


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
a.reverse()
c = 0
d = sum(a)
for i in range(n):
	c += a[i]
	if c > float(d / 2):
		print(i + 1)
		break


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

def count_min_coin(n, l):
	(s, count) = (0, 0)
	l = sorted(l)
	for i in range(n - 1, -1, -1):
		s += l[i]
		count += 1
		if s > sum(l) // 2:
			return count
print(count_min_coin(n, l))


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

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

def si():
	return input()

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

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

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

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

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

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

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

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

def main():
	n = ii()
	a = li()
	a.sort(reverse=True)
	x = sum(a) // 2
	d = 0
	for i in range(n):
		d += a[i]
		if d > x:
			print(i + 1)
			exit()
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))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = [int(input())]
a = sorted([int(x) for x in input().split()], reverse=True)
for i in range(len(a)):
	if sum(a[:i + 1]) > sum(a) / 2:
		count = i + 1
		break
print(count)


n = int(input())
mass = list(map(int, input().split()))
sum = 0
sum_for_first = 0
value = 0
for i in range(len(mass)):
	sum += mass[i]
mass = sorted(mass, reverse=True)
for i in range(len(mass)):
	sum_for_first += mass[i]
	value += 1
	if sum_for_first > sum - sum_for_first:
		break
print(value)


import math
n = int(input())
string = input()
string = string.split(' ')
list = []
sum = 0
for item in string:
	list.append(int(item))
	sum += int(item)
list.sort(reverse=True)
target = math.floor(sum / 2) + 1
count = 0
sum = 0
if n == 1:
	print(1)
else:
	while sum < target:
		sum += list[count]
		count += 1
	print(count)


n = int(input().strip('\n\r\t '))
items = [int(tmp) for tmp in input().strip('\n\r\t ').split(' ')]
items.sort(reverse=True)
all = sum(items)
for i in range(1, n + 1):
	take = sum(items[0:i])
	if take > all - take:
		print(i)
		break


import math
import os
import random
import re
from sys import stdin, stdout
from collections import Counter

def si():
	return str(input())

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

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

def li():
	return list(mi())
n = ii()
arr = li()
b = []
arr.sort()
for i in range(n):
	while sum(b) <= sum(arr):
		b += [arr.pop()]
print(len(b))


n = int(input())
coins = list(reversed(sorted(list(map(int, input().split())))))
money = sum(coins)
take = take_value = 0
for c in coins:
	take += 1
	take_value += c
	if take_value > money - take_value:
		print(take)
		quit()
print(n)


total_coin = str(input())
input_string = str(input())
coins = [int(s) for s in input_string.split(' ')]

def rev_sort_number(number):
	if len(number) > 1:
		swap_count = 1
		while swap_count > 0:
			swap_count = 0
			count = 0
			while count < len(number) - 1:
				if number[count] < number[count + 1]:
					swap = number[count]
					number[count] = number[count + 1]
					number[count + 1] = swap
					swap_count += 1
				count += 1
	return number
sorted_coin = rev_sort_number(number=coins)
sum_of_coins = 0
for coin in sorted_coin:
	sum_of_coins += coin
average = sum_of_coins / 2
sum_of_coins = 0
count = 0
while sum_of_coins < average:
	sum_of_coins += sorted_coin[count]
	count += 1
if sum_of_coins <= average:
	print(count + 1)
else:
	print(count)


n = int(input())
arr = []
sum1 = 0
inp = input().split()
for i in inp:
	arr.append(int(i))
	sum1 += int(i)
arr.sort()
sum2 = 0
t = 0
for x in reversed(arr):
	sum2 += x
	t = t + 1
	if sum2 > sum1 - sum2:
		print(t)
		break


import math
pass
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
tempSum = sum(arr)
tempSub = 0
miniCoins = 0
if n == 1:
	miniCoins = 1
elif n == 2:
	if arr[0] == arr[1]:
		miniCoins = 2
	else:
		miniCoins = 1
else:
	for i in range(n):
		tempSum = tempSum - arr[i]
		tempSub = tempSub + arr[i]
		if tempSum <= tempSub:
			miniCoins = n - i
			break
print(miniCoins)


input()
s = sorted(map(int, input().split()), key=lambda x: -x)
for i in range(len(s) + 1):
	if sum(s[:i]) > sum(s[i:]):
		print(i)
		break


input()
ls = sorted([int(x) for x in input().split()], reverse=True)
for i in range(len(ls) + 1):
	if sum(ls[0:i]) > sum(ls[i:]):
		break
print(i)


n = int(input())
coins = [int(x) for x in input().split()]
coins.sort(reverse=True)
total = sum(coins)
tmp = 0
cur = 0
for i in coins:
	tmp += i
	cur += 1
	if tmp * 2 > total:
		print(cur)
		exit()


n = int(input())
coins = list(map(int, input().split()))
sortcoins = sorted(coins)
target = sum(coins) / 2
cursum = 0
cnt = 0
for item in sortcoins[::-1]:
	cursum += item
	cnt += 1
	if cursum > target:
		break
print(cnt)


n = int(input())
v = sorted([int(x) for x in input().split()], reverse=True)
sv = sum(v) / 2
s = 0
i = 0
for c in v:
	i = i + 1
	s = s + c
	if s > sv:
		break
print(i)


n = int(input())
a = map(int, input().split())
a = list(a)
a.sort()
sumMoney = sum(a)
sumM2 = 0
kol = None
for i in range(n):
	sumM2 += a[n - 1 - i]
	if sumM2 > sumMoney // 2:
		kol = i + 1
		break
print(kol)


a = int(input())
b = input().split()
c = []
d = 0
f = 0
for i in b:
	c.append(int(i))
c.sort()
c.reverse()
e = sum(c)
for n in c:
	f += 1
	d += n
	e -= n
	if d > e:
		print(f)
		break


n = int(input())
coins = list(map(int, input().split(maxsplit=n)))
coins.sort()
coins = coins[::-1]
count = 0
summ = 0
for i in range(n):
	if summ > sum(coins[i:]):
		print(count)
		exit(0)
	else:
		count += 1
		summ += coins[i]
print(count)


n = int(input())
mas = list(map(int, input().split()))
mas.sort(reverse=True)
sum1 = sum(mas)
i = 1
sum2 = 0
for j in mas:
	sum2 += j
	sum1 -= j
	if sum2 > sum1:
		print(i)
		break
	else:
		i += 1


n = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
req = sum(arr) // 2
coin = 0
done = False
for i in arr:
	if req < 0:
		done = True
		print(coin)
		break
	else:
		req = req - i
		coin += 1
if done == False:
	print(coin)


n = int(input())
g = input().split()
h = []
for i in g:
	h.append(int(i))
a = []
a.append(max(h))
h.remove(max(h))
while sum(a) <= sum(h):
	a.append(max(h))
	h.remove(max(h))
else:
	print(len(a))


c = int(input())
i = list(map(int, input().split()))
i.sort()
i.reverse()
s = sum(i)
summ = 0
col = 0
for j in range(len(i)):
	summ += i[j]
	col += 1
	if summ > s - summ:
		print(col)
		break


number = int(input())
coins = sorted([int(i) for i in input().split(' ')], reverse=True)
total_sum = 0
for i in coins:
	total_sum += i
total_sum /= 2

def get_coin_number():
	coin_count = 0
	coin_sum = 0
	for i in coins:
		coin_sum += i
		coin_count += 1
		if coin_sum > total_sum:
			return coin_count
	return coin_count
print(get_coin_number())


n = int(input())
coins = input().split()
for i in range(n):
	coins[i] = int(coins[i])
coins = sorted(coins, reverse=True)
answer = 0
for i in range(n):
	answer = i
	left = 0
	right = 0
	for k in range(n):
		if k <= i:
			left += coins[k]
		else:
			right += coins[k]
	if left > right:
		print(answer + 1)
		break


import sys as s

def calc(str1):
	sum = num1 = 0
	lst = [int(x) for x in str1.strip().split()]
	lst = sorted(lst)
	while sum <= sum1(lst):
		sum += lst.pop()
		num1 += 1
	return num1

def sum1(lst1):
	sum2 = 0
	if len(lst1) > 0:
		for i in lst1:
			sum2 += i
	return sum2
flag = 0
for v in s.stdin:
	flag += 1
	v = v.strip()
	if flag == 2:
		if len(v) > 0:
			print(calc(v))
			break


n = int(input())
s = sorted(list(map(int, input().split())), reverse=True)
m = sum(s) // 2
d = 0
for i in range(n):
	d = d + s[i]
	if d > m:
		print(i + 1)
		break


n = int(input())
a = [int(x) for x in input().split()]
sum2 = sum(a)
sum1 = 0
for i in range(len(a)):
	for j in range(i, len(a)):
		if a[i] >= a[j]:
			pass
		else:
			(a[j], a[i]) = (a[i], a[j])
	sum2 -= a[i]
	sum1 += a[i]
	if sum1 > sum2:
		print(i + 1)
		break


import sys
N = int(sys.stdin.readline())
Coins = list(map(int, sys.stdin.readline().split()))
Coins.sort(reverse=True)
summ = sum(Coins)
sub_summ = 0
for (i, c) in enumerate(Coins):
	sub_summ += c
	summ -= c
	if sub_summ > summ:
		print(i + 1)
		break
else:
	print(i + 1)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
b = n // 2
count = 1
k = 1
if n == 1:
	print('1')
else:
	for i in range(len(a)):
		if sum(a[-k:]) > sum(a[:-k]):
			continue
		else:
			k += 1
			count += 1
	print(count)


n = int(input())
coins = sorted(list(map(int, input().split())), reverse=True)
sumL = 0
count = 0
for i in coins:
	sumL += i
	count += 1
	if sumL > sum(coins) / 2:
		print(count)
		break


n = int(input())
d = input().split()
b = []
for j in d:
	b.append(int(j))
b.sort(reverse=True)

def sum(arr):
	s = 0
	for i in arr:
		s = s + int(i)
	return s
c = []
while sum(c) <= sum(b):
	z = max(b)
	c.append(z)
	b.remove(z)
print(len(c))


n = int(input())
b = list(map(int, input().strip().split()))[:n]
b.sort()
a = 1
x = b.pop()
while 1:
	if x > sum(b):
		print(a)
		break
	else:
		a = a + 1
		x = x + b.pop()


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
l.reverse()
m = sum(l) / 2
r = 0
for i in range(n):
	r += l[i]
	if r > m:
		print(i + 1)
		break
	if r == m and i == n - 1:
		print(n)
		break


N = int(input())
L = input()
L = L.split()
A = []
for i in range(N):
	A.append(int(L[i]))
B = []
S = sum(A)
i = 0
A.sort()
A = A[::-1]
while sum(B) < S or sum(B) == S:
	S -= A[i]
	B.append(A[i])
	i += 1
print(len(B))


def Transf(A):
	for i in range(len(A)):
		A[i] = int(A[i])

def Sum(A):
	k = 0
	for i in range(len(A)):
		k += A[i]
	return k
A = int(input())
B = input()
B = B.split()
Transf(B)
BadTwin = []
while Sum(BadTwin) <= Sum(B):
	BadTwin.append(max(B))
	B.remove(max(B))
print(len(BadTwin))


_ = input()
l = list(map(int, input().split()))
l.sort()
k = []
while sum(k) <= sum(l):
	k.append(l.pop())
print(len(k))


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
a.reverse()
(me, M) = (1, int(a[0]))
s = sum(a)
for i in range(n):
	if M * 2 <= s:
		a.remove(int(a[0]))
		me += 1
		M += int(a[0])
print(me)


a = int(input())
l = [int(x) for x in input().split(' ', a - 1)]
l.sort(reverse=True)
(i, j) = (0, 0)
for x in range(len(l)):
	while i <= sum(l) - i:
		i += l[j]
		j += 1
	if i > sum(l) - i:
		print(j)
		break


k = int(input())
l = list(map(int, input().split()))
total = 0
for i in range(k):
	total += l[i]
s = 0
j = 0
l.sort(reverse=True)
for i in range(k):
	if s <= total / 2:
		s = s + l[i]
		j += 1
	else:
		break
print(j)


n = input()
c = [int(x) for x in input().split()]
c.sort()
(t, ctr) = (0, 0)
for x in range(int(n) - 1, -1, -1):
	t += c[x]
	ctr += 1
	if t > sum(c) - t:
		break
print(ctr)


n = input()
a = list(map(int, input().split()))
result = 0
suma = sum(a)
counter = 0
a.sort()
for i in range(len(a) - 1, -1, -1):
	if result <= suma:
		result += a[i]
		suma -= a[i]
		counter += 1
print(counter)


def solve_the_problem():
	n = int(input())
	coins_list = [int(x) for x in input().split(' ')]
	sorted_coins_list = sorted(coins_list, reverse=True)
	current_sum = 0
	nr_of_coins = 0
	for i in range(0, len(sorted_coins_list)):
		current_sum += sorted_coins_list[i]
		nr_of_coins += 1
		sum_twin = sum(sorted_coins_list[i + 1:])
		if current_sum > sum_twin:
			print(nr_of_coins)
			return
	print(nr_of_coins)
solve_the_problem()


num = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
mine = []
for i in range(0, len(arr), 1):
	mine.append(arr[i])
	del arr[i]
	arr.insert(i, 0)
	if sum(mine) > sum(arr):
		print(len(mine))
		break


n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
(s1, s2) = (0, 0)
count = 0
while s1 <= s2:
	s1 = sum(a[:count])
	s2 = sum(a[count:])
	count += 1
print(count - 1)


n = int(input().strip())
x = list(map(int, input().rstrip().split()))
x.sort(reverse=True)
res = n
for i in range(n):
	if sum(x[:i]) > sum(x[i:]) and res == n:
		res = i
		break
print(res)


n = int(input())
li = list(map(int, input().split()))
li = sorted(li, reverse=True)
sum = sum(li)
sum = sum // 2
sum1 = 0
count = 0
for i in li:
	sum1 += i
	count += 1
	if sum1 > sum:
		print(count)
		break


n = int(input())
coins = list(map(int, input().split(' ')))
myCoins = []
coins.sort()
for i in range(len(coins) - 1, -1, -1):
	myCoins.append(coins.pop(i))
	if sum(myCoins) > sum(coins):
		print(len(myCoins))
		break


n = int(input())
a = list(input().split())
b = [0] * 100
s = 0
for i in range(0, n):
	b[100 - int(a[i])] += 1
	s += int(a[i])
g = s // 2 + 1
gg = 0
m = 0
for i in range(0, 100):
	gg += (100 - i) * b[i]
	m += b[i]
	if gg > g or gg == g:
		break
print(int(m - (gg - g) // (100 - i)))


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
result = 0
count = 0
for num in l:
	result += num
	count += 1
	if result > sum(l) - result:
		break
print(count)


n = int(input())
s = [int(p) for p in input().split()]
s.sort()
s.reverse()
t = sum(s)
k = 0
for i in range(n):
	k += s[i]
	if k > t / 2:
		print(i + 1)
		break


n = int(input())
coin = list(map(int, input().split()))
coin.sort(reverse=True)
avg = sum(coin) / 2
i = 0
money = 0
while money <= avg:
	money += coin[i]
	i += 1
print(i)


input()
arr = sorted([int(i) for i in input().split()])[::-1]
count = 0
while sum(arr[:count]) <= sum(arr[count:]):
	count += 1
print(count)


n = int(input())
m = list(map(int, input().split()))
m.sort(reverse=True)
me = 0
cnt = 0
while sum(m) >= me:
	me = me + m[0]
	del m[0]
	cnt = cnt + 1
print(cnt)


n = int(input())
li = list(map(int, input().split()))
li.sort(reverse=True)
for i in range(n):
	if sum(li[:i + 1]) > sum(li[i + 1:]):
		print(i + 1)
		quit()


m = int(input())
arr = list(map(int, input().split()))
count = 0
me = 0
s = sum(arr)
arr.sort()
for i in reversed(arr):
	count += 1
	me += i
	s -= i
	if me > s:
		break
print(count)


cin = lambda : map(int, input().split())
input()
a = list(cin())
a.sort(reverse=True)
summ = sum(a)
res = 0
t = 0
for x in a:
	res += 1
	t += x
	if t > summ - t:
		break
print(res)


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


n = input()
array = input()
a = array.split(' ')
coins = list(map(int, a))
coins.sort()
coins.reverse()
s = sum(coins) // 2
first = 0
for i in range(int(n)):
	first += coins[i]
	if first > s:
		print(i + 1)
		exit(0)
print(n)


n = int(input())
a = sorted(map(int, input().split()))
s = 0
count = 0
while s <= sum(a):
	s += a.pop()
	count += 1
print(count)


n = int(input())
s = tuple(map(int, input().split()))
s = sorted(s)
s.reverse()
i = 0
while i < n:
	if sum(s[:i + 1]) > sum(s[i + 1:]):
		print(i + 1)
		break
	i = i + 1


from itertools import accumulate

def main():
	n = int(input())
	coins = sorted(list(map(int, input().split())), reverse=True)
	fair = sum(coins) / 2
	for (i, j) in enumerate(accumulate(coins)):
		if j > fair:
			print(i + 1)
			return
main()


n = int(input())
values = [int(n) for n in input().split()]
result = counter = 0
minimum = int(sum(values) / 2) + 1
values_sort = sorted(values)
array_iter = values_sort[::-1]
for i in range(len(array_iter)):
	result += array_iter[i]
	counter += 1
	if result >= minimum:
		break
print(counter)


import math
N = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
sum = sum(coins)
sum = sum // 2
count = newsum = 0
for i in coins:
	if newsum <= sum:
		count += 1
		newsum += i
	else:
		break
print(count)


n = int(input())
sList = list(map(int, input().split(' ')))
sList = sorted(sList)
smallSum = 0
wantedSum = 0
count = 0
for i in range(n):
	smallSum += sList[i]
while wantedSum <= smallSum:
	wantedSum += sList[n - 1]
	smallSum -= sList[n - 1]
	count += 1
	n -= 1
print(count)


n = int(input())
coins = input()
coins = coins.split()
for n in range(n):
	coins[n] = int(coins[n])
coins.sort(reverse=True)
Value = sum(coins)
mine = 0
num = 0
for coin in coins:
	mine += coin
	num += 1
	if mine > Value / 2:
		break
print(num)


n = int(input())
coins = [int(a) for a in input().split()]
total = sum(coins)
coins.sort()
qnt = 0
amount = 0
for c in reversed(coins):
	total -= c
	amount += c
	qnt += 1
	if amount > total:
		break
print(qnt)


n = input()
m = input().split()
b = []
for k in m:
	b.append(int(k))
sul = sum(b)
b.sort()
b.reverse()
rao = 0
jami = 0
for h in b:
	if jami <= sul - jami:
		jami = jami + h
		rao = rao + 1
print(rao)


amount = int(input())
coins = input().split(' ')
coins = sorted([int(x) for x in coins], reverse=True)
get = 0
for i in range(1, amount + 1):
	first = sum(coins[:i])
	second = sum(coins[i:])
	if first > second:
		get = i
		break
print(get)


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


n = int(input())
a = sorted([int(_) for _ in input().split()])
p = 0
d = 0
for i in a[::-1]:
	if sum(a) - p >= p:
		p += i
		d += 1
print(d)


n = int(input())
s = input().split()
s = map(int, s)
s = sorted(s, key=int, reverse=True)
hisCoins = sum(s)
myCoins = 0
coinsNumber = 0
for i in s:
	pass
	coinsNumber += 1
	myCoins += i
	hisCoins -= i
	if myCoins > hisCoins:
		print(coinsNumber)
		break


n = input()
l = list(map(int, input().split()))
l.sort(reverse=True)
(count, total, summ) = (0, sum(l) / 2, 0)
for i in l:
	summ += i
	count += 1
	if summ > total:
		print(count)
		break


n = int(input())
x = list(map(int, input().split()))
x.sort(reverse=True)
presum = [0] * n
presum[0] = x[0]
ans = 0
for i in range(1, n):
	presum[i] = presum[i - 1] + x[i]
for i in range(n):
	if presum[i] > presum[n - 1] - presum[i]:
		ans = i
		break
print(ans + 1)


n = int(input())
wyn = 0
tab = input().split(' ')
for i in range(len(tab)):
	tab[i] = int(tab[i])
	wyn += tab[i]
tab.sort()
moje = 0
for i in range(len(tab)):
	wyn -= tab[n - i - 1]
	moje += tab[n - i - 1]
	if moje > wyn:
		print(i + 1)
		break


n = input()
ar = input()
z = ar.split()
a = []
for i in z:
	a.append(int(i))
a.sort(reverse=True)
initial = 0
num_c = 1
sum = a[0]
sum_2 = 0
for i in range(initial, int(n)):
	for j in range(i + 1, int(n)):
		sum_2 = sum_2 + a[j]
	if sum > sum_2:
		break
	else:
		sum_2 = 0
		sum = sum + a[i + 1]
		num_c += 1
print(num_c)


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
i = n - 1
coins = 0
while i >= 0:
	if i == 0:
		coins = n
		break
	if sum(l[:i]) < sum(l[i:]):
		coins = n - i
		break
	i -= 1
print(coins)


n = int(input())
c = list(map(int, input().split()))
c.sort(reverse=True)
tHalf = sum(c) // 2
t = 0
cou = 0
for i in c:
	cou += 1
	t += i
	if t > tHalf:
		break
print(cou)


def coins(n, m):
	m = sorted(m, reverse=True)
	total = 0
	count = 0
	my_total = 0
	for x in m:
		total += x
	for y in m:
		my_total += y
		total -= y
		count += 1
		if my_total > total:
			break
	return count
n = int(input())
m = list(map(int, input().split()))
print(coins(n, m))


n = int(input())
L = input().split()
sm = 0
ans = 0
cnt = 0
for i in range(len(L)):
	L[i] = int(L[i])
	sm += L[i]
L.sort()
L.reverse()
for i in range(len(L)):
	ans += L[i]
	cnt += 1
	if ans > sm - ans:
		break
print(cnt)


n = int(input())
coins = [int(_) for _ in input().split(' ')]
coins.sort()
total = 0
for coin in coins:
	total += coin
cnt = 0
sm = 0
for i in range(n - 1, -1, -1):
	sm += coins[i]
	cnt += 1
	if sm > total - sm:
		break
print(cnt)


n = int(input())
d = list(map(int, input().split()))
tot = sum(d)
d.sort(reverse=True)
tmp = 0
x = 0
for i in d:
	tmp += i
	x += 1
	if tmp > tot // 2:
		break
print(x)


n = input()
l = list(map(int, input().split()))
l.sort(reverse=True)
total = sum(l)
my = 0
coin = 0
for i in l:
	my += i
	coin += 1
	if my * 2 > total:
		break
print(coin)


N = int(input())
L = [int(n) for n in input().split()]
s = sum(L)
L.sort(reverse=True)
m = 0
c = 0
for x in L:
	if m <= s - m:
		m += x
		c += 1
	else:
		break
print(c)


a = int(input())
i = sorted(list(map(int, input().split()))[:a], key=int, reverse=True)
j = 0
l = 0
while j <= sum(i) // 2:
	j += i[l]
	l += 1
print(l)


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


n = int(input())
z = list(map(int, input().split()))
s = sum(z)
z = sorted(z)
c = 0
k = []
for i in z:
	k.append(i)
	p = sum(k)
	if p >= s - p:
		c = c + 1
print(c)


input()
coins = sorted([int(v) for v in input().split()])
total = sum(coins)
(taken, count) = (0, 0)
while taken * 2 <= total:
	coin = coins.pop()
	taken += coin
	count += 1
print(count)


s2 = list()
s = []
n = int(input())
s1 = input()
s2 = s1.split()
for i in s2:
	s.append(int(i))
s.sort(reverse=True)
sum = 0
a = 0
c = 0
for i in s:
	sum = sum + int(i)
sum = sum / 2
for i in range(n):
	a = a + int(s[i])
	if a <= sum:
		c = c + 1
		continue
	else:
		break
print(c + 1)


n = int(input())
n -= 1
alist = [int(i) for i in input().split()]
alist.sort()
tot = sum(alist) / 2
tot = int(tot)
i = 0
while tot >= 0:
	tot = tot - alist[n - i]
	i += 1
print(i)


n = int(input())
a = list(map(int, input().split()))
h = sum(a) / 2
(c, q) = (0, 0)
a.sort()
a.reverse()
for v in a:
	q += v
	c += 1
	if q > h:
		break
print(c)


import sys
n = [int(x) for x in sys.stdin.readline().split(' ')]
cs = [int(x) for x in sys.stdin.readline().split(' ')]
cs.sort()
total = sum(cs) / 2
ss = 0
coins = 0
while ss <= total:
	ss += cs.pop()
	coins += 1
print(coins)


n = int(input())
L = input().split()
for i in range(n):
	L[i] = int(L[i])
L.sort()
L.reverse()
a = 0
for ans in range(n):
	a += L[ans]
	L1 = L[ans + 1:n]
	if a > sum(L1):
		break
print(ans + 1)


n = int(input())
coins = sorted(list(map(int, input().split())), reverse=True)
(index, value, total) = (0, 0, sum(coins))
while value <= total / 2:
	value += coins[index]
	index += 1
print(index)


n = int(input())
k = list(map(int, input().split()))
sum = 0
for i in k:
	sum = sum + i
k.sort()
k = k[::-1]
po = 0
c = 0
for i in k:
	c = c + 1
	po = po + i
	if po > sum - po:
		break
print(c)


def solve():
	n = int(input())
	coins = input().split(' ')
	coins = [int(i) for i in coins]
	coins.sort()
	leftOvers = sum(coins)
	coinsTaken = 0
	myCoins = 0
	for i in range(len(coins) - 1, -1, -1):
		if myCoins <= leftOvers:
			myCoins += coins[i]
			leftOvers -= coins[i]
			coinsTaken += 1
		else:
			break
	return coinsTaken

def main():
	print(solve())
main()


n = int(input())
a = list(map(int, input().split()))
i = 0
s = 0
while True:
	s += max(a)
	a.remove(max(a))
	i += 1
	if s > sum(a):
		print(i)
		break


a = int(input())
b = list(map(int, input().split()))
c = 0
d = 0
for x in range(a):
	c += max(b)
	b.remove(max(b))
	d += 1
	if c > sum(b):
		break
print(d)


n = int(input())
v = [int(i) for i in input().split()]
v = sorted(v)
soma = sum(v)
s = 0
c = 0
for i in range(n - 1, -1, -1):
	if soma - s >= 0:
		s += v[i]
		soma -= v[i]
		c += 1
print(c)


from itertools import accumulate
import bisect
input()
l = list(accumulate(sorted([int(x) for x in input().split(' ')], reverse=True)))
print(bisect.bisect_right(l, l[-1] / 2) + 1)


from fractions import Fraction
import sys
import bisect
import heapq
from math import *
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
import statistics
from statistics import mode
mod = 1000000007

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

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 graph(vertex):
	return [[] for i in range(0, vertex + 1)]

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

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

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

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

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

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def most_frequent(List):
	occurence_count = Counter(List)
	return occurence_count.most_common(1)[0][0]

def most_common(List):
	return mode(List)

def createMatrix(rowCount, colCount, dataList):
	mat = []
	for i in range(rowCount):
		rowList = []
		for j in range(colCount):
			if dataList[j] not in mat:
				rowList.append(dataList[j])
		mat.append(rowList)
	return mat

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
import collections

def minimalFilps1(bits):
	n = len(bits)
	flipsFromLeft = [0 for i in range(n)]
	flipsFromRight = [0 for i in range(n)]
	flips = 0
	for i in range(0, n, 1):
		if bits[i] == '1':
			flips = flips + 1
		flipsFromLeft[i] = flips
	flips = 0
	i = n - 1
	while i >= 0:
		if bits[i] == '0':
			flips = flips + 1
		i = i - 1
		flipsFromRight[i] = flips
	minFlips1 = sys.maxsize
	for i in range(1, n, 1):
		if flipsFromLeft[i - 1] + flipsFromRight[i] < minFlips1:
			minFlips1 = flipsFromLeft[i - 1] + flipsFromRight[i]
	return minFlips1

def minimalFilps(bits):
	n = len(bits)
	flipsFromLeft = [0 for i in range(n)]
	flipsFromRight = [0 for i in range(n)]
	flips = 0
	for i in range(0, n, 1):
		if bits[i] == '0':
			flips = flips + 1
		flipsFromLeft[i] = flips
	flips = 0
	i = n - 1
	while i >= 0:
		if bits[i] == '1':
			flips = flips + 1
		i = i - 1
		flipsFromRight[i] = flips
	minFlips = sys.maxsize
	for i in range(1, n, 1):
		if flipsFromLeft[i - 1] + flipsFromRight[i] < minFlips:
			minFlips = flipsFromLeft[i - 1] + flipsFromRight[i]
	return minFlips

def oddn(n):
	for i in range(2, n + 1):
		if i % 2 != 0 and n % i == 0:
			return i
	return 3
n = int(input())
a = list(map(int, input().split()))
b = 0
a.sort(reverse=True)
c = sum(a)
d = 0
for i in range(n):
	b += a[i]
	c -= a[i]
	d += 1
	if b > c:
		break
print(d)


n = int(input())
coins = [int(a) for a in input().strip().split()]
coins.sort(reverse=True)
balance = 0
num_coins = 0
for i in range(n):
	coin = coins[i]
	balance += coin
	num_coins += 1
	if balance > sum(coins[i + 1:]):
		print(num_coins)
		break


n = int(input())
coins = list(map(int, input().split(' ')))
coins = sorted(coins)
coins = coins[::-1]
half = sum(coins) / 2
answer = 0
holder = 0
i = 0
while holder <= half:
	holder += coins[i]
	answer += 1
	i += 1
print(answer)


t = input()
a = list(map(int, input().split()))
a.sort()
s = 0
l = 0
count = 0
for i in a:
	s += i
for i in a[::-1]:
	l += i
	count += 1
	if l > s / 2:
		break
print(count)


n = int(input())
a = [int(t) for t in input().split()]
b = sum(a)
c = sorted(a, reverse=True)
d = 0
for k in range(n):
	d += c[k]
	if d > b / 2:
		s = k + 1
		break
print(s)


import sys

def main(arr):
	arr.sort()
	s = sum(arr)
	c = 0
	for i in range(len(arr) - 1, -1, -1):
		c += arr[i]
		s -= arr[i]
		if c > s:
			print(len(arr) - i)
			return
for (e, line) in enumerate(sys.stdin.readlines()):
	if e == 0:
		continue
	else:
		arr = list(map(int, line.strip().split()))
main(arr)


input()
l = sorted(list(map(int, input().split())))
l.reverse()
i = 0
one = 0
two = sum(l)
while True:
	one += l[i]
	two -= l[i]
	if one > two:
		print(i + 1)
		break
	i += 1


n = int(input())
k = list(map(int, input().split()))
k.sort()
s = sum(k)
t1 = 0
t2 = s
i = 0
while i < n:
	if t1 + k[i] < t2 - k[i]:
		t1 += k[i]
		t2 -= k[i]
	else:
		break
	i += 1
print(n - i)


from math import floor
n = int(input())
coins = [int(i) for i in input().split()]
coins.sort()
halfSum = floor(sum(coins) / 2)
partialSum = 0
numCoins = 0
for coin in reversed(coins):
	partialSum += coin
	numCoins += 1
	if partialSum > halfSum:
		break
print(numCoins)


input()
a = list(map(int, input().split()))
a.sort()
total = 0
total2 = 0
counter = 0
for numbers in a:
	total += numbers
even = total // 2
a.reverse()
for numbers in a:
	total2 += numbers
	counter += 1
	if total2 > even:
		print(counter)
		break


def sort(alist):
	iteration = 0
	while iteration < len(alist):
		lowestindex = iteration
		i = iteration
		while i < len(alist):
			if alist[i] < alist[lowestindex]:
				lowestindex = i
			i += 1
		temp = alist[lowestindex]
		alist[lowestindex] = alist[iteration]
		alist[iteration] = temp
		iteration += 1
	return alist

def main():
	input()
	theirset = sorted(list(map(int, input().split())))
	myset = []
	while sum(myset) <= sum(theirset):
		myset.append(theirset.pop())
	print(len(myset))
main()


count_money = int(input())
money = input().split(' ')
moneys = []
counter_money = 0
for el in money:
	el = int(el)
	moneys.append(el)
moneys = sorted(moneys, reverse=True)
all_money = sum(moneys)
take_money = 0
for el in moneys:
	take_money += el
	all_money -= el
	counter_money += 1
	if take_money > all_money:
		answer = counter_money
		break
print(answer)


input()
a = sorted(list(map(int, input().split())), reverse=True)
s = sum(a)
ct = 0
sm = 0
while sm * 2 <= s:
	sm += a[ct]
	ct += 1
print(ct)


def swap(the_list, i, j):
	(the_list[i], the_list[j]) = (the_list[j], the_list[i])

def insertion_sort(the_list):
	total_value = the_list[0]
	for i in range(1, len(the_list)):
		current = i
		total_value += the_list[current]
		prev = i - 1
		while prev >= 0:
			if the_list[current] < the_list[prev]:
				swap(the_list, current, prev)
				current -= 1
				prev -= 1
			else:
				break
	return total_value

def find_min(values, total_value):
	n = len(values)
	my_value = values[n - 1]
	twin_value = total_value - my_value
	num_coins = 1
	i = n - 2
	while my_value <= twin_value and i >= 0:
		my_value += values[i]
		num_coins += 1
		twin_value -= values[i]
		i -= 1
	return num_coins
n = int(input())
coin_values = input().split(' ')
for i in range(len(coin_values)):
	coin_values[i] = int(coin_values[i])
total_value = insertion_sort(coin_values)
print(find_min(coin_values, total_value))


input()
X = list(map(int, input().split()))
X = sorted(X, reverse=True)
for i in range(len(X)):
	if sum(X[0:i + 1]) > sum(X[i + 1:]):
		print(i + 1)
		exit()


n = int(input())
lst = [int(x) for x in input().split()]
goal = int(sum(lst) / 2)
lst.sort()
lst.reverse()
summ = 0
coins = 0
cnt = 0
while summ <= goal:
	summ += lst[cnt]
	coins += 1
	cnt += 1
print(coins)


x = int(input())
k = input()
l = ''
y = []
n = -1
r = 0
s = 0
z = 0
m = 0
for i in range(len(k)):
	if k[i] == ' ':
		y.append(int(l))
		l = ''
	else:
		l = l + k[i]
y.append(int(l))
y.sort()
for i in y:
	s = s + i
while r <= s / 2:
	r = r + y[n]
	z = z + 1
	n = n - 1
print(z)


n = int(input())
i = list(map(int, input().split()))
i = sorted(i, reverse=True)
for j in range(1, len(i)):
	a = i[:j]
	b = i[j:]
	if sum(a) > sum(b):
		print(j)
		break
else:
	print(n)


n = int(input())
s = list(map(int, input().split()))
s1 = []
m = 0
s.sort(reverse=True)
i = 0
if n != 1:
	while True:
		s1.append(s[i])
		m += 1
		if sum(s1) > sum(s[i + 1:]):
			print(m)
			break
		i += 1
else:
	print(1)


from sys import stdin as sin
n = int(sin.readline())
l = list(map(int, sin.readline().split(' ')))
l.sort()
c = []
m = sum(l) // 2
for i in range(n - 1, -1, -1):
	if sum(c) <= m:
		c.append(l[i])
	else:
		break
print(len(c))


n = int(input())
c = list(input().split())
s1 = 0
s2 = 0
for i in range(len(c)):
	c[i] = int(c[i])
	s1 += c[i]
c.sort()
i = 0
while s1 > s2:
	s1 -= c[i]
	s2 += c[i]
	i += 1
print(len(c) - i + 1)


import functools
import logging
import os
import sys
import time
logger = logging.getLogger()
reader = sys.stdin
is_judge = os.getenv('DEBUGGING') is None

def timeit(func):

	@functools.wraps(func)
	def timed(*args, **kwargs):
		if is_judge:
			rv = func(*args, **kwargs)
		else:
			ts = time.time()
			rv = func(*args, **kwargs)
			te = time.time()
			logger.debug('performance %r %2.2fms', func.__name__, (te - ts) * 1000)
		return rv
	return timed

def tanya_sub(n, k):
	while k > 0:
		rm = n % 10
		if rm == 0:
			k -= 1
			n //= 10
		else:
			s = min(k, rm)
			k -= s
			n -= s
	return n

@timeit
def main():
	n = int(reader.readline())
	coins = [int(v) for v in reader.readline().strip().split(' ')]
	coins.sort(reverse=True)
	total = sum(coins)
	i = 0
	s = 0
	while i < n and s <= total // 2:
		s += coins[i]
		i += 1
	print(i)

def setup():
	global logger, reader
	if is_judge:
		logger.setLevel(logging.WARNING)
	else:
		handler = logging.StreamHandler(sys.stdout)
		handler.setLevel(logging.DEBUG)
		formatter = logging.Formatter('{asctime}s - {message}', style='{')
		handler.setFormatter(formatter)
		logger.addHandler(handler)
		logger.setLevel(logging.DEBUG)
		reader = open('input.txt')
setup()
try:
	main()
except KeyboardInterrupt:
	logger.debug('KeyboardInterrupt')
except IOError as e:
	logger.error(f'I/O error({e.errno}): {e.strerror}')


import sys

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

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

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

def split(n, l):
	l.sort(reverse=True)
	s = 0
	c = 0
	for i in range(n):
		if s <= sum(l) - s:
			c = c + 1
			s = s + l[i]
	return c
n = int(data())
arr = list(map(int, data().split()))
print(split(n, arr))


input()
l = sorted([int(k) for k in input().split()], reverse=True)
(acc, s) = (0, sum(l) // 2)
for (i, j) in enumerate(l):
	acc += j
	if acc > s:
		print(i + 1)
		break


n = int(input())
l = list(reversed(sorted(list(map(int, input().split())))))
s = 0
for i in range(n):
	s += l[i]
s /= 2
c = 1
while 1:
	k = 0
	for i in range(c):
		k += l[i]
	if k > s:
		break
	c += 1
print(c)


n = int(input())
x = list(map(int, input().split()))
coin_count = 0
i = 0
total_sum = 0
x.sort(reverse=True)
sum_of_x = sum(x)
while total_sum <= sum_of_x:
	total_sum += x[i]
	coin_count += 1
	sum_of_x -= x[i]
	i += 1
print(coin_count)


n = int(input())
a = str(input())
a = a.split(' ')
a = [int(aa) for aa in a]
count = 0
a.sort(reverse=True)
sum_a = 0
sum_b = 0
for aa in a:
	sum_b += aa
for aa in a:
	sum_a += aa
	sum_b -= aa
	count += 1
	if sum_a > sum_b:
		break
print(count)


def coin(seq):
	x = seq[0]
	pos = 0
	for i in range(len(seq)):
		if int(seq[i]) > int(x):
			x = seq[i]
			pos = i
	return [x, pos]
n = input()
n = int(n)
coins = input().split()
result = 0.0
t1 = 0
soma = 0
for i in coins:
	result = result + float(i)
result = result / 2.0
while len(coins) != 0 and soma <= result:
	x = coin(coins)
	soma = soma + int(x[0])
	t1 = t1 + 1
	coins.pop(x[1])
print(t1)


n = int(input())
line = [int(i) for i in input().split()]
total = sum(line)
line.sort(reverse=True)
summation = 0
i = 0
while summation <= 0.5 * total:
	summation += line[i]
	i += 1
print(i)


(_, arr) = (input(), sorted([int(i) for i in input().split()], reverse=True))
print([sum(arr[:idx + 1]) > sum(arr[idx + 1:]) for (idx, i) in enumerate(arr)].index(True) + 1)


n = int(input())
m = input()
m = m.split()
i = 0
while i < n:
	m[i] = int(m[i])
	i += 1
i = 0
while i < n:
	i += 1
	j = 0
	while j < n - 1:
		if m[j] > m[j + 1]:
			(m[j], m[j + 1]) = (m[j + 1], m[j])
		j += 1
i = 0
sum = 0
while i < n:
	sum = sum + m[i]
	i += 1
sump = 0
i = n - 1
a = 0
while sump <= sum / 2:
	sump = sump + m[i]
	i -= 1
	a += 1
print(a)


n = int(input())
mine = 0
l = [int(i) for i in input().split()]
l.sort(reverse=True)
total = sum(l)
for i in range(0, len(l)):
	mine = mine + l[i]
	total = total - l[i]
	if mine > total:
		print(i + 1)
		break


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
n_1 = 0
n_2 = 0
for i in a:
	n_2 += i
cnt = 0
while n_2 >= n_1:
	n_1 += a[cnt]
	n_2 -= a[cnt]
	cnt += 1
print(cnt)


n = int(input())
list1 = list(map(int, input().split()))
list1.sort(reverse=True)
sum1 = sum(list1)
sum1 = sum1 // 2 + 1
s = 0
c = 0
for i in list1:
	if s < sum1:
		s = s + i
		c = c + 1
	else:
		print(c)
		break
else:
	print(c)


n = int(input())
lista = input().split()
listb = []
x = 0
y = 0
for i in range(n):
	listb = listb + [int(lista[i])]
	y = y + int(lista[i])
for i in range(n):
	x = x + max(listb)
	y = y - max(listb)
	listb.remove(max(listb))
	if x > y:
		print(i + 1)
		break


n = int(input())
c = list(map(int, input().split()))
if len(c) == n:
	i = 0
	ma_s = 0
	while i <= n:
		ma_s += max(c)
		c.remove(max(c))
		l_sum = sum(c)
		i += 1
		if ma_s > l_sum:
			print(i)
			break
		else:
			continue


def main():
	n = int(input())
	coins = [int(x) for x in input().strip().split()]
	s = sum(coins) / 2
	coins.sort(reverse=True)
	current_number = 0
	current_sum = 0
	for coin in coins:
		current_sum += coin
		current_number += 1
		if current_sum > s:
			break
	print(current_number)
main()


n = int(input())
list = input().split()
for i in range(n):
	list[i] = int(list[i])
list.sort()
list.reverse()
sum = 0
total = 0
for i in list:
	total += i
i = 0
while not sum > total - sum:
	sum += list[i]
	i += 1
print(i)


n = int(input())
l = list(map(int, input().split()))
l.sort()
x = sum(l)
y = 0
c = 0
while y <= x:
	y = y + l[n - 1]
	x = x - l[n - 1]
	n = n - 1
	c = c + 1
print(c)


n = int(input())
t = list(map(int, input().split()))
t.sort()
t = t[::-1]
c = n
for i in range(1, n):
	if sum(t[:i]) > sum(t[i:]):
		c = i
		break
print(c)


def fun():
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	i = n - 1
	while i >= 0:
		if sum(l[:i]) < sum(l[i:]):
			print(n - i)
			break
		i -= 1
fun()


n = int(input())
x = list(map(int, input().split()))
x.sort()
x.reverse()
y = sum(x)
count = 0
i = 0
while count * 2 <= y:
	count = count + x[i]
	i += 1
print(i)


n = int(input())
k = list(map(int, input().split()))
length = len(k)
blank_list = []
add = sum(k)
if add % 2 == 0:
	values = add / 2 + 1
else:
	values = add // 2 + 1
for i in range(length):
	max_value = max(k)
	blank_list.append(max_value)
	k.remove(max_value)
	if sum(k) < sum(blank_list):
		print(len(blank_list))
		break


n = int(input())
mas = sorted(list(map(int, input().split())))
new_mas = []
while True:
	new_mas.append(mas.pop())
	if sum(new_mas) > sum(mas):
		break
print(len(new_mas))


n = int(input())
ai = str(input())
arr = ai.split(' ')
for i in range(len(arr)):
	arr[i] = int(arr[i])
arr = sorted(arr, reverse=True)
ans = 0
sumof = 0
for i in range(len(arr)):
	sumof += arr[i]
	ans += 1
	if sumof > sum(arr[i + 1:]):
		break
print(ans)


in1 = input()
l1 = list(map(int, input().split()))
c = 0
x = 0
l1.sort(reverse=True)
for i in range(len(l1)):
	if x > sum(l1[i:]):
		break
	else:
		x += l1[i]
		c += 1
print(c)


n = int(input())
l = list(map(int, input().strip().split()))
l.sort(reverse=True)
k = sum(l) // 2
s = 0
c = 0
for i in l:
	if s > k:
		break
	s += i
	c += 1
print(c)


import sys
input = sys.stdin.readline

def int_array():
	return list(map(int, input().split()))
n = input().strip()
arr = int_array()
arr.sort(reverse=True)
a_arr = []
for i in range(len(arr)):
	if sum(arr[:i + 1]) > sum(arr[i + 1:]):
		a_arr = arr[:i + 1]
		break
print(len(a_arr))


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


a = input()
b = input()
a = int(a)
b = [int(i) for i in b.split()]
s = sum(b)
b.sort(reverse=True)
cnt = 0
my_s = 0
for i in b:
	if s - my_s < my_s:
		break
	else:
		my_s += i
		cnt += 1
print(cnt)


n = int(input())
a = list(sorted(map(int, input().split())))
(s, greedy_bro, i) = (sum(a), 0, n - 1)
while s >= greedy_bro:
	s -= a[i]
	greedy_bro += a[i]
	i -= 1
print(n - 1 - i)


n = int(input())
l = list(map(int, input().strip().split()))
l.sort()
s = sum(l)
c = 0
cnt = 0
for i in l[::-1]:
	c += i
	cnt += 1
	if c > s / 2:
		break
print(cnt)


n = int(input())
lis = [int(x) for x in input().split()]
lis = sorted(lis)
s = sum(lis)
s1 = 0
c = 0
i = n - 1
while s1 <= s:
	c = c + 1
	s = s - lis[i]
	s1 = s1 + lis[i]
	i = i - 1
print(c)


def fun1(inp_str):
	arr = inp_str.split(' ')
	arr = sorted([int(x) for x in arr], reverse=True)
	arr_sum = sum(arr)
	first_boys_sum = 0
	for (i, first_coin) in enumerate(arr):
		first_boys_sum += first_coin
		if first_boys_sum > arr_sum - first_boys_sum:
			break
	return i + 1
n = input()
coin_str = input()
print(fun1(coin_str))


n = int(input())
array = input().split()
for i in range(n):
	array[i] = int(array[i])
array = sorted(array)
w = sum(array)
s = 0
c = 0
i = n - 1
while s <= w // 2:
	s += array[i]
	c += 1
	i -= 1
print(c)


n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
num = sum(a)
for i in range(n):
	a.pop(0)
	s = sum(a)
	b = num - s
	if b > s:
		break
print(i + 1)


n = int(input())
z = input()
coins = z.split()
sum = 0
for i in range(n):
	coins[i] = int(coins[i])
	sum += coins[i]
coins.sort()
mine = 0
for j in range(1, n + 1):
	mine += coins[-j]
	still = sum - mine
	if still < mine:
		break
print(j)


n = int(input())
arr = list(map(int, input().strip().split(' ')))
arr.sort()
(count, s) = (0, [])
for i in range(n):
	x = arr.pop()
	s.append(x)
	count = count + 1
	if sum(s) > sum(arr):
		print(count)
		break


def rex():
	n = int(input())
	x = input().split(' ')
	for i in range(n):
		x[i] = int(x[i])
	x = sorted(x, reverse=True)
	sumr = sum(x) / 2
	csum = 0
	for i in range(n):
		csum += x[i]
		if csum > sumr:
			return i + 1
	return 0
print(rex())


n = int(input())
sib = 0
your = 0
a = [int(x) for x in input().split()]
for i in a:
	sib += i
nc = 0
while sib >= your:
	if len(a) != 0:
		cn = max(a)
	else:
		break
	a.remove(cn)
	sib -= cn
	your += cn
	nc += 1
print(nc)


input()
coins = input().split(' ')
coins = [int(coin) for coin in coins]
coins.sort(reverse=True)
halfValue = sum(coins) / 2
myValue = 0
coinsTaken = 0
for coin in coins:
	myValue += coin
	coinsTaken += 1
	if myValue > halfValue:
		break
print(coinsTaken)


import re
n = int(input())
x = [int(j) for j in re.split(' ', input())]
x.sort(key=None, reverse=True)
s = 0
for j in x:
	s += j
i = 0
for j in range(0, n):
	i += x[j]
	if i > s / 2:
		print(j + 1)
		exit()


input()
a = list(map(int, input().split()))
count = 0
temp = 0
a.sort(reverse=True)
s = sum(a)
i = 0
for i in a:
	temp = temp + 1
	count = count + i
	s = s - i
	if s < count:
		break
print(temp)


n = int(input())
a = list(map(int, input().split()))
pref = []
a = sorted(a, reverse=True)
now = 0
tot = sum(a)
for i in a:
	now += i
	pref.append(now)
i = 0
ans = 0
for i in range(n):
	if pref[i] > tot // 2:
		ans = i
		break
print(i + 1)


amount = int(input())
money = input().split()
money = [int(m) for m in money]
money.sort(reverse=True)
for i in range(amount):
	my = sum(money[:i + 1])
	bro = sum(money[i + 1:])
	if my > bro:
		print(len(money[:i + 1]))
		break


n = int(input())
data = [int(i) for i in input().split()]
data.sort()
for i in range(n):
	if sum(data[n - i - 1:]) > sum(data) / 2:
		print(str(i + 1))
		break


n = int(input())
a = list(map(int, input().rstrip().split()))
a.sort(reverse=True)
tot = sum(a)
s = 0
count = 0
for i in a:
	s += i
	count += 1
	if s > tot - s:
		break
print(count)


n = int(input())
L = list(map(int, input().split()))
L.sort(reverse=True)
numcoins = 0
currvalue = 0
sm = sum(L)
for i in L:
	numcoins += 1
	currvalue += i
	if currvalue > sm / 2:
		break
print(numcoins)


n = int(input())
coins = [int(x) for x in input().split()]
coins.sort(reverse=True)
half_money = sum(coins) / 2
s = 0
for i in range(n):
	s += int(coins[i])
	if s > half_money:
		print(i + 1)
		break


n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
(t, count) = (0, 0)
s = sum(a)
for i in a:
	if t <= s:
		t += i
		s -= i
		count += 1
	else:
		break
print(count)


my_count = 0
n = int(input())
coins = [int(x) for x in input().split()]
coins = sorted(coins)
total = sum(coins)
total_of_coins = len(coins)
i = 0
while i < total_of_coins and my_count <= total / 2:
	my_count += coins[total_of_coins - 1 - i]
	i += 1
print(i)


a = int(input())
b = input().split(' ')
for n in range(a):
	b[n] = int(b[n])
b.sort()
s = sum(b) / 2
d = 1
c = 0
for j in reversed(b):
	c += int(j)
	if c > s:
		break
	d += 1
print(d)


n = int(input())
list = input().split()
a = []
for i in list:
	a.append(int(i))
a.sort(reverse=True)
sum = 0
sum1 = 0
for i in a:
	sum += i
for i in range(n):
	sum1 += a[i]
	if sum1 > sum / 2:
		print(i + 1)
		break


x = int(input())
y = list(map(int, input().split()))
y.sort()
Sum = 0
avali = 0
for i in range(x):
	Sum += y[i]
for i in range(x - 1, -1, -1):
	avali += y[i]
	if avali > Sum - avali:
		print(x - i)
		break
	else:
		continue


n = int(input())
a = sorted(list(map(int, input().split())))
sum1 = 0
b = list()
while sum1 <= sum(a):
	sum1 += a[-1]
	b.append(a[-1])
	a.remove(a[-1])
print(len(b))


n = input()
n = int(n)
coins = list(map(int, input().split()))
coins.sort()
sum_ = 0
for i in range(n):
	sum_ += coins[i]
my_coins = 0
ans = 0
i = n - 1
while i > -1 and my_coins <= sum_ / 2:
	my_coins += coins[i]
	i -= 1
	ans += 1
print(ans)


def seperateints(x):
	k = ''
	l = []
	for i in x:
		if i == ' ':
			l.append(int(k))
			k = ''
			continue
		k = k + i
	l.append(int(k))
	return l
n = int(input())
l = seperateints(input())
l = sorted(l)
x = 0.5 * sum(l)
s = 0
f = 0
for i in range(len(l) - 1, -1, -1):
	if s > x:
		break
	s = s + l[i]
	f += 1
print(f)


n = int(input())
arr = list(map(int, input().strip().split()))
sum1 = sum(arr)
arr.sort()
rsum = 0
c = 0
cnt = 0
for i in arr[::-1]:
	c += i
	cnt += 1
	if c > sum1 // 2:
		break
print(cnt)


num_coins = int(input())
coins = sorted([int(x) for x in input().split()], reverse=True)
half = sum(coins) / 2
num = 0
mysum = 0
for coin in coins:
	if mysum <= half:
		mysum = mysum + coin
		num = num + 1
print(num)


m = input()
x = [int(x) for x in input().split()]
x.sort(reverse=True)
y = sum(x)
a = b = 0
for i in x:
	if y >= a:
		y = y - i
		a = a + i
		b += 1
	else:
		break
print(b)


j = int(input(''))
kuruslar = input('')
kuruslar = kuruslar.split()
kuruslar = list(map(int, kuruslar))
kuruslar = sorted(kuruslar, reverse=True)
toplamDeger = 0
for i in kuruslar:
	toplamDeger += i
alinanKurusSayisi = 0
alinanKurusMiktari = 0
for i in kuruslar:
	if toplamDeger / 2 < alinanKurusMiktari:
		break
	alinanKurusMiktari += i
	alinanKurusSayisi += 1
print(alinanKurusSayisi)


import sys
input = sys.stdin.readline
n = int(input().strip())
a = list(map(int, input().strip().split()))
a.sort(reverse=True)
for i in range(n + 1):
	if sum(a[:i]) > sum(a[i:]):
		print(i)
		exit(0)


i = int(input())
list1 = input().split()
list2 = []
for x in list1:
	list2.append(int(x))
list2.sort(reverse=True)
c = 0
s = 0
m = float(sum(list2) / 2)
while s <= m:
	s += list2[0]
	list2.pop(0)
	c += 1
print(c)


__author__ = 'runekri3'
input()
coins = list(map(int, input().split(' ')))
coins.sort()
goal_sum = int(sum(coins) / 2.0 + 1)
your_sum = 0
taken_coins = 0
while your_sum < goal_sum:
	your_sum += coins.pop()
	taken_coins += 1
print(taken_coins)


a = int(input())
l1 = [int(x) for x in input().split()]
need = sum(l1) / 2
l1.sort(reverse=True)
i = 0
while i < len(l1) and need >= 0:
	need -= l1[i]
	i += 1
print(i)


n = int(input())
arr = list(map(int, input().split()))
arr = sorted(arr, reverse=True)
h = [arr[0]]
for i in range(1, n):
	h.append(arr[i] + h[i - 1])
ans = 0
for (i, j) in enumerate(h):
	if j > h[-1] - h[i]:
		break
	ans += 1
print(ans + 1)


def sort(n):
	for i in range(0, len(n)):
		for j in range(0, len(n) - i - 1):
			if n[j] > n[j + 1]:
				(n[j], n[j + 1]) = (n[j + 1], n[j])
	return n
n = int(input())
x = list(map(int, input().split()))
sort(x)
coin = []
while sum(coin) <= sum(x):
	if n > 1:
		coin.append(x[-1])
		x.pop()
	else:
		coin.append(0)
		break
print(len(coin))


n = int(input())
m = input().split()
s = 0
l = []
for i in m:
	i = int(i)
	s += i
	l.append(i)
s = s // 2
l.sort()
l.reverse()
a = 0
i = 0
while a <= s:
	a += l[i]
	i += 1
print(i)


lines = []
while True:
	try:
		lines.append(input())
	except EOFError:
		break
coins = lines[1].split(' ')
coins_int = []
for x in coins:
	coins_int.append(int(x))
sum_coins = sum(coins_int)
coins_int.sort(reverse=True)
twin_total = sum_coins
my_total = 0
count_mine = 0
for x in range(0, len(coins_int)):
	twin_total = twin_total - coins_int[x]
	my_total = my_total + coins_int[x]
	count_mine = count_mine + 1
	if my_total > twin_total:
		break
	else:
		continue
print(count_mine)


from sys import stdin
n = int(stdin.readline())
a = list(map(int, stdin.readline().rstrip().split()))
a.sort()
count = 1
sum1 = a[-1]
for i in range(n - 2, -1, -1):
	if sum1 > sum(a[0:i + 1]):
		break
	else:
		sum1 += a[i]
		count += 1
print(count)


def find_no_of_terms(list):
	sum = 0
	length = len(list)
	for i in list:
		sum = sum + i
	sum_till_now = 0
	for j in reversed(range(length)):
		for i in range(j):
			if list[i] > list[i + 1]:
				(list[i], list[i + 1]) = (list[i + 1], list[i])
		sum_till_now = sum_till_now + list[j]
		if 2 * sum_till_now > sum:
			return length - j
no_of_inputs = int(input())
list_of_numbers = list(map(int, input().split(' ')))
print(find_no_of_terms(list_of_numbers))


num_coins = int(input())
coin_values = input()
coin_values = coin_values.split()
coins = 0
for x in range(0, len(coin_values)):
	coin_values[x] = int(coin_values[x])
coin_values.sort()
coin_values = coin_values[::-1]
sum_coins = sum(coin_values)
for x in range(1, num_coins + 1):
	if sum(coin_values[0:x]) > sum_coins - sum(coin_values[0:x]):
		coins = x
		break
print(coins)


n = int(input())
coin = [int(i) for i in input().split()]
coin.sort()
coin.reverse()
for i in range(n + 1):
	if sum(coin[:i]) > sum(coin[i:]):
		break
	else:
		continue
print(i)


n = int(input())
values = sorted(map(int, input().split()), reverse=True)
total = sum(values)
(soma, coins) = (0, 0)
for a in values:
	soma += a
	coins += 1
	if soma > total - soma:
		break
print(coins)


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

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

def main():
	n = int(input())
	arr = list(unpack(int))
	half = sum(arr) / 2
	arr.sort()
	ans = curr = 0
	for i in range(n - 1, -1, -1):
		curr += arr[i]
		ans += 1
		if curr > half:
			break
	print(ans)
main()


n = int(input())
arr = list(map(int, input().split()))
tot = sum(arr)
my = 0
count = 0
arr = sorted(arr, reverse=True)
for i in range(n):
	if my <= tot:
		tot -= arr[i]
		count += 1
		my += arr[i]
	else:
		break
print(count)


n = int(input())
l = list(map(int, input().split()))
l.sort()
l.reverse()
i = 1
while not sum(l[:i]) > sum(l[i:]):
	i += 1
print(i)


n = int(input())
lst = list(map(int, input().split()))
lst = sorted(lst, reverse=True)
sumi = sum(lst)
i = 1
suma = lst[0]
j = 1
while suma <= sumi // 2:
	i += 1
	suma += lst[j]
	j += 1
print(i)


def mod():
	x = int(input())
	n = list(map(int, input().split()))
	n.sort(reverse=True)
	c = 0
	z = []
	for i in range(len(n)):
		z.append(n[i])
		if sum(z) > sum(n) - sum(z):
			print(len(z))
			break
mod()


n = int(input())
a = sorted([int(i) for i in input().split()], reverse=True)
s = sum(a)
t = 0
for i in range(n):
	t += a[i]
	if t > s - t:
		print(i + 1)
		exit()


n = int(input())
lst = list(map(int, input().split()))
lst.sort()
lst.reverse()
i = 0
tong = sum(lst)
your = 0
while your <= tong:
	tong -= lst[i]
	your += lst[i]
	i += 1
print(i)


n = int(input())
li = sorted(map(int, input().split()))
li.reverse()
a = 0
b = 0
for i in range(n):
	b = b + li[i]
for i in range(n):
	a = a + li[i]
	if a > b / 2:
		print(i + 1)
		break


s = input()
x = sorted(map(int, input().split()))
valor = 0
coins = 0
while valor <= sum(x):
	valor += x.pop()
	coins += 1
print(coins)


num_coins = int(input())
coin_values = list(map(int, input().split(' ')))
coin_values.sort()
half = sum(coin_values) / 2
total = 0
coin_count = 0
for k in range(num_coins - 1, -1, -1):
	total += coin_values[k]
	coin_count += 1
	if total > half:
		break
print(coin_count)


n = int(input())
b = list(map(int, input().split()))
b = sorted(b)
one = 0
two = 0
for i in range(n):
	one += b[i]
i = 0
while two <= one:
	two += b[len(b) - i - 1]
	one -= b[len(b) - i - 1]
	i += 1
print(i)


n = int(input())
coins = []
coins = list(map(int, input().split()))
i = 0
sum = 0
max = 0
index = 0
cont = 0
remanent = 0
temp = 0
for i in range(0, n):
	sum += coins[i]
coins.sort(reverse=True)
for i in range(0, n):
	index = temp + coins[i]
	remanent = sum - index
	if index <= remanent:
		cont = cont + 1
		temp = temp + coins[i]
	else:
		cont = cont + 1
		break
print(cont)


d = int(input())
v = list(map(int, input().split()))
s = [0] * d
i = 0
for i in range(len(v) - 1):
	for j in range(len(v) - 1):
		if v[j] < v[j + 1]:
			(v[j], v[j + 1]) = (v[j + 1], v[j])
i = 0
while sum(s) <= sum(v):
	n = s[i]
	s[i] = v[i]
	v[i] = n
	i = i + 1
print(i)


n = input()
a = list(map(int, input().split()))
a.sort(reverse=True)
total = sum(a)
i = 0
count = 0
while i < len(a) and count <= total / 2:
	count += a[i]
	i += 1
print(i)


n = int(input())
l = sorted(map(int, input().split()))
s = c = 0
for i in range(n):
	if s <= sum(l):
		s += l.pop()
		c += 1
print(c)


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)
sssss = input()
a = [int(x) for x in input().split()]
quick_sort(a, 0, len(a) - 1)
x = sum(a) / 2
n = 0
times = 0
l = 0
for i in a:
	if n >= x:
		print(len(a) - times + 1)
		l += 1
		break
	elif n < x:
		times += 1
		n += i
if l == 0:
	print(len(a) - times + 1)


n = int(input())
l = list(map(int, input().split(' ')))
s = []
sum1 = 0
coin = 0
for i in range(len(l)):
	if sum1 <= sum(l):
		s.append(l.pop(l.index(max(l))))
		sum1 = sum(s)
		coin += 1
	else:
		break
print(coin)


x = 0
n = int(input(''))
numbers = input('').split(' ')
int_numbers = list(map(lambda x: int(x), numbers))
int_numbers = sorted(int_numbers, reverse=True)
N = sum(int_numbers)
for i in range(n):
	x = x + int_numbers[i]
	if x * 2 > N:
		print(i + 1)
		break


n = int(input())
list2 = [int(i) for i in input().split()]
list2.sort(reverse=True)
sum1 = sum(list2)
x = sum1 / 2
m = 0
total = 0
i = 0
while total <= x:
	total = total + list2[i]
	m = m + 1
	i = i + 1
print(m)


import math
n = int(input())
a = list(map(int, input().split()))
b = sum(a)
a.sort(reverse=True)
sumi = 0
cnt = 0
for i in a:
	sumi += i
	cnt += 1
	if sumi > b - sumi:
		print(cnt)
		break


n = int(input())
a = input()
a = a.split()
i = 0
sum = 0
while i < n:
	a[i] = int(a[i])
	sum = a[i] + sum
	i += 1
i = 0
while i < n:
	i += 1
	j = 0
	while j < n - 1:
		if a[j] > a[j + 1]:
			(a[j], a[j + 1]) = (a[j + 1], a[j])
		j += 1
i = 0
b = 0
d = n
while b <= sum / 2:
	b = b + a[d - 1]
	d = d - 1
	i += 1
print(i)


n = int(input())
a = list(map(int, input().split()))
c = 0
t = 0
while 1:
	m = min(a)
	c += m
	if sum(a) - min(a) <= c:
		break
	t += 1
	a.remove(m)
print(n - t)


num = int(input())
coins = list(map(int, input().split()))
(answer, temp) = (0, 0)
for coin in sorted(coins, reverse=True):
	temp += coin
	answer += 1
	if temp > sum(coins) / 2:
		break
print(answer)


n = int(input())
ar = list(map(int, input().split()))
ar.sort()
s = sum(ar) // 2
c = 1
t = ar[n - 1]
while t <= s:
	c += 1
	t += ar[n - c]
print(c)


n = int(input())
c = [int(x) for x in input().split()]
sum = 0
for i in c:
	sum += i
h = sum / 2
c.sort(reverse=True)
new_sum = 0
ct = 0
for i in c:
	new_sum += i
	ct += 1
	if new_sum > h:
		break
print(ct)


def solve(l):
	Sum = sum(l)
	(counter, A) = (0, 0)
	for i in reversed(l):
		A += i
		counter += 1
		if A > Sum - A:
			break
	return counter
n = int(input())
list = list(map(int, input().split()))[:n]
list.sort()
print(solve(list))


nbCoins = int(input())
coins = list(map(int, input().split()))
coins = list(reversed(sorted(coins)))
total = sum(coins)
taken = 0
i = 0
while taken <= total / 2:
	taken += coins[i]
	i += 1
print(i)


n = int(input())
coins = [int(i) for i in input().split()]
coins.sort(reverse=True)

def num_coins(coins, n):
	for i in range(n):
		if sum(coins[:i]) > sum(coins[i:]):
			return i
	return n
print(num_coins(coins, n))


n = input()
l = sorted([int(x) for x in input().split()], reverse=True)
s = sum(l)
y = 0
i = 0
while y <= s - y:
	y = y + l[i]
	i += 1
print(i)


from sys import stdin, stdout
I = lambda : stdin.readline().strip()
read = lambda : list(map(int, input().split()))
n = int(I())
arr = read()
s = sum(arr)
arr.sort(reverse=True)
temp = count = 0
s1 = s / 2
for i in arr:
	temp += i
	count += 1
	if temp > s1:
		break
print(count)


qtd_moedas = int(input())
pes_moedas = input().split()
meu_total = 0
total_moedas = 0
minhas_moedas = 0
posicao_maior = -1
for i in range(qtd_moedas):
	total_moedas += int(pes_moedas[i])
while meu_total <= total_moedas - meu_total:
	maior_moeda = 0
	posicao_maior = -1
	for j in range(qtd_moedas):
		if int(pes_moedas[j]) > maior_moeda:
			maior_moeda = int(pes_moedas[j])
			posicao_maior = j
	meu_total += int(pes_moedas[posicao_maior])
	pes_moedas[posicao_maior] = 0
	minhas_moedas += 1
print(minhas_moedas)


import math
n = int(input(''))
nums = list(map(int, input('').split(' ')))
s = sum(nums)
s = s // 2
nums.sort(reverse=True)
total = 0
count = 0
for i in range(len(nums)):
	total += nums[i]
	count += 1
	if total > s:
		break
print(count)


n = int(input())
coins = [int(x) for x in input().split()]
coins = sorted(coins, reverse=True)
take = []
while sum(coins) >= sum(take):
	take.append(coins[0])
	coins.remove(coins[0])
if len(coins) + len(take) == n:
	print(len(take))
else:
	pass


n = int(input())
l1 = list(map(int, input().split()))
l1.sort(reverse=True)
sum1 = 0
for i in range(n):
	sum1 = sum1 + l1[i]
	sum2 = sum(l1[i + 1:])
	if sum1 > sum2:
		c = i + 1
		break
print(c)


a = int(input())
c = [int(x) for x in input().split()]
c.sort(reverse=True)
d = sum(c)
d = int(d / 2) + 1
sumi = 0
i = 0
for j in c:
	sumi = sumi + j
	i = i + 1
	if sumi >= d:
		break
print(i)


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


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


t = int(input())
a = [int(x) for x in input().split()]
b = sorted(a, reverse=True)
s = sum(a)
flag = 0
c = 0
for j in range(0, t):
	c = c + int(b[j])
	flag = flag + 1
	if c > s / 2:
		break
print(flag)


n = int(input())
coins = [int(i) for i in input().split()]
coins.sort()
l = []
while sum(l) <= sum(coins):
	l.append(coins.pop())
print(len(l))


n = int(input())
a = input().split(' ')
for j in range(0, len(a)):
	a[j] = int(a[j])
a = sorted(a, reverse=True)
s = sum(a)
i = 0
sa = 0
while sa <= s / 2:
	sa += a[i]
	i += 1
print(i)


n = int(input())
A = list(map(int, input().split()))
A.sort()
A.reverse()
sum = 0
for i in range(len(A)):
	sum += A[i]
s = 0
l = 0
for i in range(len(A)):
	if s <= sum // 2:
		s += A[i]
		l += 1
print(l)


while True:
	n = int(input())
	if n >= 1 and n <= 100:
		break
liste = []
a = input().split(' ')
for i in range(n):
	liste.append(int(a[i]))
liste = sorted(liste)
liste = liste[::-1]
cnt = 0
res = 0
for j in range(n):
	res += liste[j]
	cnt += 1
	if res > sum(liste) / 2:
		break
print(cnt)


a = int(input())
b = list(map(int, input().split()))
b.sort(reverse=True)
s = [b.pop(0)]
for i in range(a):
	if sum(s) > sum(b):
		print(len(s))
		break
	else:
		s.append(b.pop(0))


n = int(input())
values = list(map(int, input().split()))
my = 0
sm = sum(values)
values.sort(reverse=True)
cnt = 0
for i in range(n):
	my += values[i]
	sm -= values[i]
	cnt += 1
	if my > sm:
		break
print(cnt)


qtd_coins = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
amount = sum(coins)
amount_my_coins = 0
qtd_my_coins = 0
for i in range(qtd_coins):
	if amount_my_coins > amount - amount_my_coins:
		break
	amount_my_coins += coins[i]
	qtd_my_coins += 1
print(qtd_my_coins)


n = int(input())
coins = [int(x) for x in input().split()]
coins.sort()
s = sum(coins)
i = n - 1
aux = 0
t = 0
while aux <= s:
	aux += coins[i]
	s -= coins[i]
	i -= 1
	t += 1
print(t)


n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
x = sum(a)
y = 0
m = 0
while y <= x:
	y += a[m]
	x -= a[m]
	m += 1
print(m)


n1 = int(input())
n2 = input()
n2 = n2.split(' ')
if n1 < 1 or n1 > 100:
	quit()
for i in range(0, n1):
	if int(n2[i]) < 1 or int(n2[i]) > 100:
		quit()
sum1 = 0
for i in range(0, n1):
	sum1 += int(n2[i])
sum2 = 0
count = 0
temp = 0
for i in range(n1):
	for j in range(i, n1):
		if int(n2[i]) < int(n2[j]):
			temp = int(n2[i])
			n2[i] = n2[j]
			n2[j] = temp
for i in range(0, n1):
	sum2 += int(n2[i])
	count += 1
	if sum1 - sum2 < sum2:
		break
print(count)


n = input()
a = input().split()
b = [int(i) for i in a]
b.sort()
b.reverse()
c = 0
d = 0
for i in range(len(b)):
	c = c + b[i]
i = 0
while d <= c / 2:
	d = d + b[i]
	i += 1
print(i)


n = int(input())
c = sorted(list(map(int, input().split())))[::-1]
r = 0
for (k, coin) in enumerate(c):
	if sum(c[:k]) > sum(c[::-1][:n - k]):
		r = k
		break
if r == 0:
	r = n
print(r)


n = int(input())
coin = [int(coin) for coin in input().split()]
coin.sort()
sum1 = sum2 = count = 0
count1 = count2 = 0
i = -1
j = n
while j - i > 2:
	if sum2 > sum1:
		i += 1
		sum1 += coin[i]
		count1 += 1
		continue
	else:
		j -= 1
		sum2 += coin[j]
		count2 += 1
		continue
if sum2 > sum1:
	if sum2 - sum1 > coin[i + 1]:
		count = count2
	else:
		count = count2 + 1
if sum1 >= sum2:
	count = count2 + 1
if n == 1:
	count = 1
print(count)


num_coins = int(input())
coins = list(map(int, input().split()))
half_sum = sum(coins) / 2
coins.sort(reverse=True)
solution = 0
for coin in coins:
	half_sum -= coin
	solution += 1
	if half_sum < 0:
		break
print(solution)


n = int(input())
a = [int(i) for i in input().split(' ')]
a = sorted(a, reverse=True)
take = 1
total = a[0]
for i in range(n):
	if total > sum(a[take:n + 1]):
		break
	else:
		total += a[take]
		take += 1
print(take)


n = int(input())
mylist = sorted(list(map(int, input().split())))
mylist.reverse()
a = 0
b = 1
for item in mylist:
	k = 0
while a <= b:
	mylist2 = mylist[:k]
	mylist3 = mylist[k:]
	a = sum(mylist2)
	b = sum(mylist3)
	k = k + 1
print(k - 1)


n = int(input())
coins = [int(i) for i in input().split()]
coins.sort(reverse=True)
total = sum(coins)
(my_total, total_coins) = (0, 0)
for i in range(0, n):
	if my_total + coins[i] <= total - coins[i]:
		total_coins += 1
		my_total += coins[i]
		total -= coins[i]
	else:
		total_coins += 1
		break
print(total_coins)


size = int(input())
arr = [int(n) for n in input().split()]
total = sum(arr)
list.sort(arr)
ptr = size - 1
coins = 0
mySum = 0
while mySum <= total:
	mySum += arr[ptr]
	total -= arr[ptr]
	ptr -= 1
	coins += 1
print(coins)


def solve(n, a):
	sum = 0
	for value in a:
		sum += value
	a.sort(reverse=True)
	yourTotal = 0
	yourCoinsCount = 0
	half = sum // 2
	for value in a:
		if yourTotal > half:
			break
		yourTotal += value
		yourCoinsCount += 1
	return yourCoinsCount
n = int(input())
a = list(map(int, input().split()))
print(solve(n, a))


n = int(input())
x = input()
y = x.split()
z = [int(d) for d in y]
z.sort(reverse=True)
sum_z = sum(z)
sum = 0
count = 0
for i in z:
	if sum <= sum_z // 2:
		sum = sum + i
		count += 1
print(count)


n = int(input())
l = list(map(int, input().split()))
l.sort()
l.reverse()
l1 = []
for i in range(len(l)):
	l1.append(l[i])
	if sum(l1) > sum(l) / 2:
		break
print(len(l1))


import sys
n = input()
en = int(n)
a = input().split(' ')
ay = []
sum = 0
currentValue = 0
numberOfCoins = 0
for i in a:
	ay.append(int(i))
	sum = sum + int(i)
ay.sort(reverse=True)
while sum / 2 >= currentValue:
	currentValue += ay[numberOfCoins]
	numberOfCoins += 1
print(numberOfCoins)


n = int(input())
coins = sorted(list(map(int, input().strip().split())))
twin = 0
i = n - 1
while i >= 0:
	if sum(coins[0:i]) < sum(coins[i:n]):
		print(len(coins[i:n]))
		break
	i -= 1


a = int(input())
b = [int(x) for x in input().split()]
b.sort(reverse=True)
sumarr = 0
for i in range(len(b)):
	sumarr = sumarr + b[i]
fsarr = 0
if len(b) == a:
	for j in range(len(b)):
		fsarr = fsarr + b[j]
		if fsarr > int(sumarr / 2 + 0.33):
			print(j + 1)
			break


n = int(input())
values = list(map(int, input().strip().split(' ')))
values.sort(reverse=True)
t = sum(values) // 2 + 1
t_ = 0
for (i, c) in enumerate(values):
	t_ += c
	if t_ >= t:
		print(i + 1)
		break


int(input())
c = input().split()
v = 0
t = 0
for i in range(len(c)):
	c[i] = int(c[i])
c = sorted(c, reverse=True)
for i in c:
	if v > sum(c):
		break
	else:
		t += 1
		v += i
		c = c[1:]
print(t)


n = int(input())
arr = [int(i) for i in input().strip().split()]
arr.sort(reverse=True)
t = sum(arr)
big = 0
k = 0
for i in arr:
	big += i
	k += 1
	if big > t - big:
		break
print(k)


n = int(input())
arr = sorted(list(map(int, input().split())), reverse=True)
agg = sum(arr)
(reqagg, count) = (0, 0)
while reqagg <= agg // 2:
	reqagg += arr[count]
	count += 1
print(count)


n = int(input())
s = list(map(int, input().split()))
s.sort(reverse=True)
summ = 0
count = 0
mid = sum(s) / 2.0
for i in s:
	summ += i
	count += 1
	if summ > mid:
		break
print(count)


import sys
import time
import os
from math import sqrt, log, log2, ceil, log10, gcd, floor, pow, sin, cos, tan, pi, inf, factorial
from copy import copy, deepcopy
from sys import exit, stdin, stdout
from collections import Counter, defaultdict, deque
from itertools import permutations
import heapq
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = 1000000007
iinp = lambda : int(sys.stdin.readline())
inp = lambda : sys.stdin.readline().strip()
strl = lambda : list(inp().strip().split(' '))
intl = lambda : list(map(int, inp().split(' ')))
mint = lambda : map(int, inp().split())
flol = lambda : list(map(float, inp().split(' ')))
flush = lambda : stdout.flush()

def permute(nums):

	def fun(arr, nums, cur, v):
		if len(cur) == len(nums):
			arr.append(cur.copy())
		i = 0
		while i < len(nums):
			if v[i]:
				i += 1
				continue
			else:
				cur.append(nums[i])
				v[i] = 1
				fun(arr, nums, cur, v)
				cur.pop()
				v[i] = 0
				i += 1
		return arr
	res = []
	nums.sort()
	v = [0] * len(nums)
	return fun(res, nums, [], v)

def subsets(res, index, arr, cur):
	res.append(cur.copy())
	for i in range(index, len(arr)):
		cur.append(arr[i])
		subsets(res, i + 1, arr, cur)
		cur.pop()
	return res

def sieve(N):
	root = int(sqrt(N))
	primes = [1] * (N + 1)
	(primes[0], primes[1]) = (0, 0)
	for i in range(2, root + 1):
		if primes[i]:
			for j in range(i * i, N + 1, i):
				primes[j] = 0
	return primes

def bs(arr, l, r, x):
	if x < arr[0] or x > arr[len(arr) - 1]:
		return -1
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	p = int(sqrt(n))
	for i in range(5, p + 1, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def solve():
	n = iinp()
	arr = intl()
	arr.sort(reverse=True)
	ans = 0
	s = 0
	while arr:
		if s <= sum(arr):
			s += arr.pop(0)
			ans += 1
		else:
			break
	print(ans)
start_time = time.time()
solve()


n = int(input())
a = sorted(list(map(int, input().split())))
a.reverse()
total = sum(a) // 2
sum = count = 0
while sum <= total:
	sum += a[count]
	count += 1
print(count)


n = int(input())
m = list(map(int, input().split()))
m = sorted(m)
mr = m[::-1]
summ = 0
for i in range(n):
	summ = summ + mr[i]
	if summ > sum(mr) / 2:
		print(i + 1)
		break


def count1(cur, arr, sum1):
	if sum(cur) > sum1:
		return len(cur)
	cur.append(arr[0])
	sum1 -= arr[0]
	return count1(cur, arr[1:], sum1)
n = int(input())
arr = list(map(int, input().split()))
arr = sorted(arr, reverse=True)
sum1 = sum(arr)
print(count1([], arr, sum1))


def helpful_maths(n, str1):
	n = int(n)
	coins = [int(i) for i in str1.split(' ')]
	coins_2 = []
	n_coins = 0
	coins = sorted(coins)
	while True:
		coins_2.append(coins.pop())
		n_coins += 1
		n -= 1
		if sum(coins) < sum(coins_2):
			return n_coins
print(helpful_maths(input(), input()))


n = int(input())
l = sorted(map(int, input().split()))[::-1]
q = sum(l)
w = 0
for i in range(n):
	w += l[i]
	if 2 * w > q:
		print(i + 1)
		break


numberOfCoins = int(input())
line = input()
line = line.split(' ')
coins = []
for i in range(numberOfCoins):
	coins.append(int(line[i]))
coins = sorted(coins, reverse=True)
limit = sum(coins) / 2
coin = 0
for i in range(numberOfCoins):
	coin += coins[i]
	if coin > limit:
		print(i + 1)
		break


N = int(input())
a = list(map(int, input().split()))

def minElements(arr, n):
	halfSum = 0
	for i in range(n):
		halfSum = halfSum + arr[i]
	halfSum = int(halfSum / 2)
	arr.sort(reverse=True)
	res = 0
	curr_sum = 0
	for i in range(n):
		curr_sum += arr[i]
		res += 1
		if curr_sum > halfSum:
			return res
	return res
print(minElements(a, N))


n = int(input())
l = [int(i) for i in input().split()]
l = sorted(l, reverse=True)
s = sum(l)
ss = 0
for (i, v) in enumerate(l):
	ss += v
	if ss > s / 2:
		print(i + 1)
		break


n = int(input())
arr = list(map(int, input().strip().split()))
s = sum(arr)
(g, c) = (0, 0)
arr.sort(reverse=True)
for i in arr:
	g += i
	s -= i
	c += 1
	if g > s:
		break
print(c)


n = int(input())
coins = list(map(int, input().split()))
s = 0
sort_coins = sorted(coins)
while s <= sum(sort_coins):
	s += sort_coins[-1]
	sort_coins.pop()
print(len(coins) - len(sort_coins))


n = input()
a = [int(x) for x in input().split()]
b = sorted(a)
h = sum(b[:len(b) - 1])
k = b[len(b) - 1]
n = 1
while h >= k:
	k += b[len(b) - 1 - n]
	h -= b[len(b) - 1 - n]
	n += 1
print(n)


a = int(input())
b = list(map(int, input().split()[:a]))
c = 0
d = 0
count = 0
while c <= d:
	c += max(b)
	b.remove(max(b))
	d = sum(b)
	count += 1
print(count)


n = int(input())
s = list(map(int, input().strip().split()))
s.sort()
s.reverse()
sums = sum(s)
num = 0
i = 0
while num <= sums / 2:
	num = num + s[i]
	i = i + 1
print(i)


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
a = sum(l) / 2
i = -1
b = 0
if n == 1:
	print('1')
else:
	while i >= -int(n / 2):
		b = b + l[i]
		if b > a:
			print(-i)
			break
		elif i == -int(n / 2):
			print(-i + 1)
		i -= 1


def take_coins(numberOfCoins, coins):
	coinsList = coins.split(' ')
	for i in range(len(coinsList)):
		coinsList[i] = int(coinsList[i])
	coinsList = mergeSort(coinsList)
	coinsList.reverse()
	mySum = 0
	myCoins = 0
	twinSum = sum(coinsList)
	i = 0
	while mySum <= twinSum and i < len(coinsList):
		mySum += coinsList[i]
		twinSum -= coinsList[i]
		myCoins += 1
		i += 1
	return myCoins

def mergeSort(aList):
	tmp = [None] * len(aList)
	start = 0
	end = len(aList) - 1
	helperMergeSort(aList, start, end, tmp)
	return aList

def helperMergeSort(aList, start, end, tmp):
	if start < end:
		mid = (start + end) // 2
		helperMergeSort(aList, start, mid, tmp)
		helperMergeSort(aList, mid + 1, end, tmp)
		mergeLists(aList, start, mid, end, tmp)
		for i in range(start, end + 1):
			aList[i] = tmp[i]
	return

def mergeLists(aList, start, mid, end, tmp):
	i = start
	j = mid + 1
	for k in range(start, end + 1):
		if i > mid:
			tmp[k] = aList[j]
			j += 1
		elif j > end:
			tmp[k] = aList[i]
			i += 1
		elif aList[i] <= aList[j]:
			tmp[k] = aList[i]
			i += 1
		else:
			tmp[k] = aList[j]
			j += 1
	return
numberOfCoins = int(input())
coins = input()
print(take_coins(numberOfCoins, coins))


n = int(input())
coins = [int(s) for s in input().split()]
coins = sorted(coins)
s = 0
for i in range(n - 1, -1, -1):
	s += 1
	if sum(coins[:i]) < sum(coins[i:n + 1]):
		break
print(s)


import sys
counter = int(input())
lst = list(map(int, input().split()))
lst.sort(reverse=True)
max = lst[0]
sum = sum(lst)
count = 1
for i in range(1, len(lst)):
	if sum - max >= max:
		max += lst[i]
		count += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
flag = False
for i in range(1, n):
	if sum(a[:i]) > sum(a[i:]):
		print(i)
		flag = True
		break
if not flag:
	print(n)


INPUT = input()
INPUT = INPUT.split()
n = INPUT
INPUT = input()
INPUT = INPUT.split()
a = []
for i in range(len(INPUT)):
	a.append(int(INPUT[i]))

def insertion_sort(l):
	for i in range(1, len(l)):
		j = i - 1
		key = l[i]
		while l[j] > key and j >= 0:
			l[j + 1] = l[j]
			j -= 1
		l[j + 1] = key
insertion_sort(a)
b = a
list2 = []
ValueofB = 0
ValueofA = 0
for i in range(len(b)):
	ValueofB += b[i]
for i in range(len(a) - 1, -1, -1):
	list2.append(a[i])
	ValueofA += a[i]
	ValueofB -= a[i]
	if ValueofA > ValueofB:
		print(len(list2))
		break


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


no_of_coins = int(input())
values = input().split()
x = list(map(int, values))
n = eval('+'.join(values))
i = 0
p = 0
x.sort(reverse=True)
while i < no_of_coins:
	if p <= n / 2:
		p = p + x[i]
		i = i + 1
	else:
		break
print(i)


n = int(input())
ar = input().split()
for i in range(n):
	ar[i] = int(ar[i])
s = sum(ar)
mp = 0
for i in range(n):
	mp += max(ar)
	if mp > s - mp:
		print(i + 1)
		break
	ar.remove(max(ar))


n = int(input())
a = list(map(int, input().split()))
s = sum(a)
for i in range(0, n - 1):
	for j in range(0, n - 1 - i):
		if a[j] < a[j + 1]:
			sw = a[j]
			a[j] = a[j + 1]
			a[j + 1] = sw
res = 0
count = 0
for i in range(0, n):
	res = res + a[i]
	count = count + 1
	if res > s // 2:
		print(count)
		break


n = int(input())
l = list(map(int, input().split()))
su = sum(l) // 2
s = 0
k = 0
l.sort()
l = l[::-1]
for i in range(n):
	if s <= su:
		s = s + l[i]
		k = k + 1
	else:
		break
print(k)


n = int(input())
m = [int(k) for k in input().split()]
k = sum(m)
m.sort()
m.reverse()
i = 0
t = m[0]
while t <= k - t:
	i += 1
	t += m[i]
print(i + 1)


n = int(input())
data = [int(a) for a in input().strip(' ').split(' ')]
data = list(reversed(sorted(data)))
ours = list()
for (num, mon) in enumerate(data):
	ours.append(mon)
	if sum(ours) > sum(data[num + 1:]):
		print(len(ours))
		break


n = int(input())
l = input().split(' ')
coins = list(map(int, l))
coins.sort(reverse=True)
val = 0
cnt = 0
for i in range(n + 1):
	if sum(coins[0:i]) > sum(coins[i:n]):
		cnt = len(coins[0:i])
		break
print(cnt)


n = int(input())
sum1 = 0
sum2 = 0
a = [int(x) for x in input().split()]
a.sort()
m = 0
for x in range(0, n):
	sum2 += a[x]
for x in range(0, n):
	sum1 += a[n - 1 - x]
	sum2 -= a[n - 1 - x]
	m += 1
	if sum1 > sum2:
		print(m)
		break


n = int(input())
s = sorted([int(i) for i in input().split()], reverse=True)
s = s[:n]
SumOfPickedCoins = 0
NumPickedCoins = 0
for i in s:
	SumOfPickedCoins += i
	NumPickedCoins += 1
	if SumOfPickedCoins > sum(s) - SumOfPickedCoins:
		break
print(NumPickedCoins)


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
count = 0
s = sum(coins)
r = 0
for i in coins:
	if r > s - r:
		break
	r += i
	count += 1
print(count)


n = int(input())
arr = sorted([int(i) for i in input().split()], reverse=True)
i = 0
while sum(arr[:i]) <= sum(arr[i:]):
	i += 1
print(len(arr[:i]))


n = int(input())
ai = list(map(int, input().split()))
ai.sort()
half = sum(ai) / 2
ans = 0
for i in range(n - 1, -1, -1):
	if half < 0:
		break
	half -= ai[i]
	ans += 1
print(ans)


import math
n = int(input())
coins = list(map(int, input().split(' ')))
total_sum = 0
coin_sum = 0
count = 0
for i in range(n):
	total_sum += coins[i]
for i in range(n):
	maximum = i
	for j in range(i + 1, n):
		if coins[maximum] < coins[j]:
			maximum = j
	temp = coins[i]
	coins[i] = coins[maximum]
	coins[maximum] = temp
for i in range(n):
	if coin_sum > total_sum / 2:
		break
	else:
		coin_sum += coins[i]
		count += 1
print(count)


n = int(input())
(*ar,) = map(int, input().split())
ar.sort()
(Sum, cnt) = (0, 0)
while sum(ar) >= Sum:
	Sum += ar.pop()
	cnt += 1
print(cnt)


arr = []
n = int(input())
p = 0
c = 0
arr = list(map(int, input().split()))
arr.sort(reverse=True)
for i in range(n):
	p += arr[i]
	for k in range(i + 1, n):
		c += arr[k]
	if p > c:
		print(i + 1)
		break
	elif c >= p:
		c = 0
	else:
		print(n)


t = int(input())
l = []
l = input().split(' ')
for i in range(len(l)):
	l[i] = int(l[i])
l.sort()
ans = 0
for i in l:
	ans += i
sum = 0
count = 0
for i in range(len(l) - 1, -1, -1):
	if sum > ans / 2:
		break
	else:
		count += 1
		sum += l[i]
print(count)


import sys
import math
numberOfCoins = int(sys.stdin.readline().rstrip())
strCoins = sys.stdin.readline().rstrip().split()
coins = []
for strCoin in strCoins:
	coins.append(int(strCoin))
coins.sort()
coins.reverse()
totalCoins = 0
for coin in coins:
	totalCoins += int(coin)
coinCount = 0
greedyTwin = 0
half = math.floor(totalCoins / 2)
for coin in coins:
	greedyTwin += int(coin)
	coinCount += 1
	if greedyTwin > half:
		break
print(coinCount)


a = int(input())
suma = 0
suma1 = 0
b = input()
b = b.split()
monedas = 0
for k in range(a):
	b[k] = int(b[k])
	suma = suma + int(b[k])
b.sort(reverse=True)
for s in range(a):
	suma1 = suma1 + b[s]
	monedas = monedas + 1
	if suma1 > suma - suma1:
		break
print(monedas)


n = int(input())
lst = [int(x) for x in input().split()]
lst.sort(reverse=True)
r = 0
s = sum(lst)
for i in range(0, n):
	r += lst[i]
	s -= lst[i]
	if r > s:
		break
print(i + 1)


n = int(input())
a = list(map(int, input().strip().split(' ')))
x = sum(a)
p = x
a.sort()
c = 0
for i in range(n - 1, -1, -1):
	p -= a[i]
	c += 1
	if float(p) < x / 2:
		break
print(c)


n = input()
din = [int(i) for i in input().split()]
s = sum(din)
t = 0
dout = 0
k = 0
for i in range(100, 0, -1):
	if k == 1:
		break
	if (t + i * din.count(i)) * 2 <= s:
		t += i * din.count(i)
		dout += din.count(i)
		continue
	for j in range(din.count(i)):
		t += i
		dout += 1
		if 2 * t > s:
			k = 1
			break
print(dout)


g = int(input())
a = list(input())
d = 1
f = 0
j = 0
h = []
e = 0
i = ''
while j < len(a):
	if a[j] == ' ':
		e = e + int(i)
		h.append(int(i))
		i = ''
	else:
		i = i + a[j]
		if j == len(a) - 1:
			e = e + int(i)
			h.append(int(i))
	j = j + 1
a = h
g = len(a)
b = g - 1

def sort(a, d):
	b = 0
	while b < d:
		if a[b] > a[b + 1]:
			c = a[b]
			a[b] = a[b + 1]
			a[b + 1] = c
		b = b + 1
	return a
while b > -1:
	a = sort(a, b)
	f = f + a[b]
	if f > e // 2:
		print(g - b)
		b = 0
	b = b - 1


t = int(input())
n = input().split(' ')
su = 0
sum1 = 0
c = 0
i = 1
for j in range(t):
	n[j] = int(n[j])
n = sorted(n, reverse=True)
while su <= sum1:
	su = 0
	sum1 = 0
	for j in range(0, i):
		su += n[j]
	for k in range(i, len(n)):
		sum1 += n[k]
	c += 1
	i += 1
print(c)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
a.insert(0, 0)
s = 0
for i in range(1, n + 1):
	s = s + a[i]
ss = 0
for i in range(1, n + 1):
	ss = ss + a[i]
	if ss > s - ss:
		print(i)
		break


n = int(input())
coins1 = [int(x) for x in input().split()]
coins2 = list(reversed(sorted(coins1)))
allthe = sum(coins2)
mine = 0
for i in range(n):
	mine += coins2[i]
	if mine > allthe / 2:
		ge = i + 1
		break
	else:
		continue
print(ge)


n = int(input())
cost = [int(x) for x in input().split()]
cost.sort(reverse=True)
new = []
i = 0
while sum(new) <= sum(cost) and i < n:
	new.append(cost.pop(0))
	i += 1
print(len(new))


n = int(input())
a = list(map(int, input().split()))
s = 0
b = sum(a)
a.sort()
a.reverse()
x = b / 2
b = 0
c = 0
z = 0
while z < len(a) and b <= x:
	b = b + a[z]
	z += 1
	c += 1
print(c)


n = int(input())
coin = list(map(int, input().split()))
coin.sort(reverse=True)
s = 0
my = 0
for i in range(n):
	s += coin[i]
s2 = s / 2
for x in range(n):
	my += coin[x]
	if my > s2:
		break
print(x + 1)


def minCoins(coins):
	coins.sort(reverse=True)
	total = 0
	index = 0
	coinCount = 0
	for coin in coins:
		total += int(coin)
		coinCount += 1
		if total > sum(coins[index + 1:len(coins)]):
			return coinCount
		index += 1
nums = int(input())
listOfInputs = input().split()
coins = []
for i in range(nums):
	coins.append(int(listOfInputs[i]))
print(minCoins(coins))


x = int(input())
y = list(map(int, input().split()))
coins = []
for i in range(x):
	if sum(y) >= sum(coins):
		coins.append(max(y))
		y.remove(max(y))
print(len(coins))


numberOfCoins = int(input())
coins = list(map(int, input().split()))
coins = sorted(coins, reverse=True)
if numberOfCoins == 1:
	print('1')
else:
	for index in range(numberOfCoins):
		if sum(coins[:index + 1]) > sum(coins[index + 1:]):
			print(index + 1)
			break


s = input()
s = list(map(int, input().split()))
k = 0
cur = 0
summa = sum(s) // 2 + 1
s.sort()
for i in s[::-1]:
	cur += i
	k += 1
	if cur >= summa:
		break
print(k)


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(n,) = I()
l = I()
l.sort(reverse=True)
for i in range(n + 1):
	if sum(l[:i]) > sum(l[i:]):
		print(i)
		break


num = int(input())
lis = list(map(int, input().split()))
lis.sort()
lis.reverse()
money = 0
x = 0
for i in lis:
	if money <= sum(lis) / 2:
		money += i
		x += 1
print(x)


(pocet, coins) = (int(input()), list(map(int, input().split())))
coins.sort(reverse=True)
(sucet, sucet2) = (0, 0)
for coin in coins:
	sucet += coin
for i in range(len(coins)):
	sucet2 += coins[i]
	if sucet2 > sucet - sucet2:
		print(i + 1)
		break


n = int(input())
l = list(map(int, input().split()))
l.sort()
(maxl, maxr) = ([0] * (n + 1), [0] * (n + 1))
for i in range(n):
	maxl[i + 1] = maxl[i] + l[i]
	maxr[n - i - 1] = maxr[n - i] + l[n - i - 1]
(lo, hi) = (0, n - 1)
idx = 0
while hi >= lo:
	mid = lo + hi >> 1
	if maxl[mid] < maxr[mid]:
		idx = max(idx, mid)
		lo = mid + 1
	else:
		hi = mid - 1
print(n - idx)


n = int(input())
v = sorted([int(e) for e in input().split()], reverse=True)
mine = 0
s = sum(v)
for (i, e) in enumerate(v):
	mine += e
	if mine > s // 2:
		print(i + 1)
		break


n = int(input())
data = sorted([int(x) for x in input().split()])[::-1]
count = 0
minimum = sum(data)
while minimum >= sum(data[:count]):
	count += 1
	minimum = sum(data[count:])
print(count)


n = int(input())
l = list(map(int, input().split()))
ans = sum(l) // 2
l.sort(reverse=True)
(su, j) = (0, 0)
for i in l:
	su += i
	j += 1
	if su > ans:
		break
print(j)


n = int(input())
temp_list = str(input()).split()
temp_list = [int(it) for it in temp_list]
temp_sum = sum(temp_list)
temp_list.sort(reverse=True)
print_flag = False
for i in range(n):
	if sum(temp_list[:i]) * 2 > temp_sum:
		print_flag = True
		print(i)
		break
if not print_flag:
	print(n)


input()
coins = sorted(list(map(int, input().split())), reverse=True)
sum = sum(coins)
me = 0
i = 0
while me <= sum / 2 and i <= len(coins):
	me += coins[i]
	i += 1
print(i)


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


n = int(input())
coins = [int(j) for j in input().split()]
total = sum(coins)
half = total // 2
coins.sort()
coins.reverse()
cnt = 0
Sum = 0
for i in coins:
	Sum += i
	cnt += 1
	if Sum > half:
		break
print(cnt)


import math
a = int(input())
c = input()
b = []
c = c.split()
for i in c:
	b.append(int(i))
b.sort()
sum1 = 0
for i in b:
	sum1 = sum1 + int(i)
i = len(b) - 1
sum2 = 0
while i >= 0:
	sum2 += int(b[i])
	sum1 -= int(b[i])
	if sum2 > sum1:
		break
	else:
		i -= 1
print(len(b) - i)


num = int(input())
coin = [int(x) for x in input().split()]
coin.sort()
summ = 0
summ1 = 0
check = len(coin) - 1
for i in range(len(coin)):
	summ += coin[i]
while summ1 <= summ / 2:
	summ1 += coin[check]
	check -= 1
print(len(coin) - check - 1)


n = int(input())
fridge = list(map(int, input().split()))
fridge.sort(reverse=True)
counter_money = 0
counter_my = 0
counter_broher = sum(fridge)
for i in range(len(fridge)):
	if counter_my <= counter_broher:
		counter_money += 1
		counter_my += fridge[i]
		counter_broher -= fridge[i]
	else:
		break
print(counter_money)


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


n = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
idx = 1
while sum(A[:idx]) <= sum(A[idx:]) and idx != len(A):
	idx += 1
print(idx)


a = int(input())
b = []
k = input()
cnt = 0
i = 0
while cnt < a:
	num = 0
	while i < k.__len__() and k[i] != ' ':
		num = num * 10 + int(k[i])
		i = i + 1
	b.append(num)
	cnt = cnt + 1
	i = i + 1
b.sort()
c = b[::-1]
sum = 0
d = []
for i in c:
	sum += i
	d.append(sum)
cnt = 1
for i in d:
	if i > sum - i:
		break
	cnt += 1
print(cnt)


n = int(input())
a = [int(x) for x in input().split(' ')[:n]]
tw2 = a
tw1 = []
for i in range(n):
	if sum(tw1) > sum(tw2):
		break
	else:
		c = max(tw2)
		tw1.append(c)
		tw2.remove(c)
print(len(tw1))


n = int(input())
a = list(map(int, input().split()))
a.sort()
s = sum(a)
x = 0
y = s
ind = n - 1
cnt = 0
while x <= y:
	x += a[ind]
	y -= a[ind]
	cnt += 1
	ind -= 1
print(cnt)


def main(num, coins):
	coins = sorted(coins)
	total = sum(coins)
	coinCount = 0
	mine = 0
	ind = num - 1
	while mine <= total - mine:
		mine += coins[ind]
		ind -= 1
		coinCount += 1
	return coinCount
num = int(input())
coins = [int(c) for c in input().split()]
print(main(num, coins))


input()
a = [int(i) for i in input().split()]
a.sort()
s = 0
count = 0
for i in reversed(a):
	count += 1
	s += i
	if s > sum(a) - s:
		break
print(count)


n = int(input())
a = list(map(int, input().split()))
a = list(sorted(a))
tot = sum(a) // 2
count = 0
s = 0
while s <= tot:
	count += 1
	s += a[n - count]
print(count)


n = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse=True)
k = 0
for i in a:
	k += i
m = 0
x = 0
for i in a:
	if m <= k:
		x += 1
		m += i
		k -= i
	else:
		break
print(x)


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()]
total = sum(A)
A.sort(reverse=True)
t = 0
for i in range(N):
	t += A[i]
	if t * 2 > total:
		print(i + 1)
		exit(0)


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


n = int(input())
values = list(map(int, input().split()))
values.sort(reverse=True)
for i in range(0, n):
	if sum(values[:i + 1]) > sum(values) / 2:
		print(i + 1)
		break


def remainder(arr):
	s = 0
	for i in arr:
		s += i
	return s
n = int(input())
a = [int(i) for i in input().split()]
a = sorted(a)[::-1]
s = c = 0
for i in range(len(a)):
	if s <= remainder(a[i:]):
		s += a[i]
		c += 1
print(c)


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


input_s = int(input())
input_l = input().split(' ')
list_l = []
for i in input_l:
	list_l.append(int(i))
for i in range(input_s):
	for j in range(i + 1, input_s):
		if list_l[i] < list_l[j]:
			(list_l[i], list_l[j]) = (list_l[j], list_l[i])
is_ok = False
for i in range(1, input_s):
	a = sum(list_l[0:i])
	b = sum(list_l[i:input_s])
	if a > b:
		print(i)
		is_ok = True
		break
if not is_ok:
	print(input_s)


class MoneyMoneyMoney:

	def __init__(self, array):
		self.array = array
		self.total = sum(array)
		self.mine = 0

	def _mergesort(self, _array):
		alen = len(_array)
		if alen > 1:
			mid = alen // 2
			L = _array[:mid]
			R = _array[mid:]
			self._mergesort(L)
			self._mergesort(R)
			a = b = c = 0
			while a < len(L) and b < len(R):
				if L[a] < R[b]:
					_array[c] = L[a]
					a += 1
				else:
					_array[c] = R[b]
					b += 1
				c += 1
			while a < len(L):
				_array[c] = L[a]
				a += 1
				c += 1
			while b < len(R):
				_array[c] = R[b]
				b += 1
				c += 1

	def _givemoney(self):
		removed = self.array.pop()
		self.mine += removed
		self.total -= removed

	def distribute(self):
		self._mergesort(self.array)
		counter = 0
		while self.total >= self.mine:
			counter += 1
			self._givemoney()
		return counter
arrsize = input()
array = input().split()
array = [int(a) for a in array]
money = MoneyMoneyMoney(array)
print(money.distribute())


n = int(input().rstrip())
ai = [int(i) for i in input().rstrip().split()]
ai.sort(reverse=True)
ssum = sum(ai) / 2
sums = 0
cnt = 0
for i in range(n):
	sums += ai[i]
	cnt += 1
	if sums > ssum:
		print(cnt)
		break


import string
n = int(input())
list1 = list(map(int, input().split()))
list1.sort(reverse=True)
count = 1
total = 0
total2 = list1[0]
for i in range(n):
	total = total + list1[i]
total -= list1[0]
for i in range(1, n + 1):
	if total2 > total:
		print(count)
		break
	else:
		total = total - list1[i]
		total2 += list1[i]
		count += 1


input()
a = [int(i) for i in input().split(' ')]
a.sort(reverse=True)
s = 0
n = 0
for i in range(len(a)):
	s += a[i]
	n += 1
	if i + 1 < len(a):
		if s > sum(a[i + 1:]):
			print(n)
			quit()
print(n)


n = int(input())
l = [int(u) for u in input().split()]
l.sort(reverse=True)
if n == 1:
	print(1)
else:
	for i in range(n):
		if sum(l[:i + 1]) > sum(l[i + 1:]):
			print(i + 1)
			break


n = int(input())
lst = input().split()
l = []
for i in lst:
	l.append(int(i))
l = sorted(l)
total = 0
count = 0
num_take = 0
for i in range(len(l)):
	total += int(l[i])
for i in range(len(l)):
	if count > total / 2:
		break
	else:
		count += int(l[~i])
		num_take += 1
print(num_take)


n = int(input())
arr = [int(x) for x in input().split(' ')]
sum = 0
for i in range(len(arr)):
	sum += arr[i]
arr.sort(reverse=True)
temp = int(0)
count = int(1)
for i in range(len(arr)):
	temp += arr[i]
	if temp > sum - temp:
		break
	count += 1
print(count)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
s = sum(a) // 2
(y, count) = (0, 0)
for i in range(1, n + 1):
	y += a[-i]
	count += 1
	if y > s:
		break
print(count)


n = int(input())
coins = [int(i) for i in input().split()]
coins.sort(reverse=1)
s = 0
count = 0
a = sum(coins) / 2
for c in coins:
	s += c
	count += 1
	if s > a:
		break
print(count)


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


n = int(input())
lis = list(map(int, input().split()))
all_sum = sum(lis)
lis = sorted(lis)[::-1]
count = 0
mymoney = 0
for i in lis:
	mymoney += i
	all_sum -= i
	count += 1
	if mymoney > all_sum:
		print(count)
		break


n = int(input())
a = input().split(' ')
lst = [int(i) for i in a]
sorted_lst = sorted(lst)
mine = 0
yours = sum(sorted_lst)
for i in range(n):
	mine += sorted_lst[-1]
	yours -= sorted_lst[-1]
	del sorted_lst[-1]
	if mine > yours:
		print(i + 1)
		break


n = int(input())
coin = list(map(int, input().split()))
myMoney = 0
coinCount = 0
while myMoney <= sum(coin):
	coinCount += 1
	myMoney += max(coin)
	coin.pop(coin.index(max(coin)))
print(coinCount)


n = int(input())
s = list(map(int, input().split()))
s = sorted(s)
s.reverse()
a = 0
b = 0
for r in s:
	b = b + r
i = 0
while i < n:
	if a > b / 2:
		break
	else:
		a = a + s[i]
	i = i + 1
print(i)


n = int(input())
ip = input()
l = ip.split()
coins = []
for i in l:
	coins.append(int(i))
coins.sort(reverse=True)
for i in range(1, n + 1):
	if sum(coins[0:i]) > sum(coins[i:]):
		print(i)
		break


n = int(input())
mon = []
mon = input().split()
much = 0
my = 0
for i in mon:
	much += int(i)
money = list(map(int, mon))
money.sort()
money.reverse()
for i in range(n):
	my = my + money[i]
	much = much - money[i]
	if my > much:
		print(i + 1)
		exit()
	else:
		pass


n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
flag = 0
ans = 0
for x in range(len(a)):
	a1 = a[0:x]
	a2 = a[x:]
	if sum(a1) > sum(a2):
		ans = len(a1)
		flag = 1
		break
if flag == 1:
	print(ans)
else:
	print(n)


def fun(array):
	RightSum = sum(array)
	LeftSum = 0
	p = 0
	for i in array:
		p += 1
		LeftSum += i
		RightSum -= i
		if LeftSum > RightSum:
			break
	return p
p = input()
array = list(map(int, input().split()))
array.sort(reverse=True)
print(fun(array))


n = int(input())
inp = input()
inp = inp.split(' ')
a = []
for i in inp:
	a.append(int(i))
a.sort(reverse=True)
tar = sum(a) / 2
s = 0
c = 0
for i in a:
	s = s + i
	c = c + 1
	if s > tar:
		break
print(c)


n = int(input())
l = input().split()
r = 0
for i in range(n):
	l[i] = int(l[i])
	r += l[i]
l.sort()
l.reverse()
s = 0
p = 0
for i in range(n):
	if 2 * s > r:
		print(i)
		p = 1
		break
	s += l[i]
if p == 0:
	print(n)


def f(s, s1, s2):
	if (s, s1, s2) in d:
		return d[s, s1, s2]
	if s1 > s2:
		d[s, s1, s2] = 0
		return d[s, s1, s2]
	elif s < 0:
		d[s, s1, s2] = float('inf')
		return d[s, s1, s2]
	else:
		x = 1 + f(s - 1, s1 + a[s], s2 - a[s])
		y = f(s - 1, s1, s2)
		d[s, s1, s2] = min(x, y)
		return d[s, s1, s2]
n = int(input())
a = list(map(int, input().split()))
a.sort()
(s1, s2) = (0, sum(a))
(c1, c2) = (0, n)
i = n - 1
while i >= 0 and s1 <= s2:
	s2 -= a[i]
	s1 += a[i]
	c2 -= 1
	c1 += 1
	i -= 1
print(c1)


number = int(input())
price1 = list(input().split(' '))
price = []
total_price = 0
A = 0
n = 0
for i in price1:
	i = int(i)
	total_price += i
	price.append(i)
price2 = sorted(price, reverse=True)
for i in price2:
	A += i
	n += 1
	if 2 * A > total_price:
		print(n)
		break


n = int(input())
l1 = [int(x) for x in input().split()]
l2 = sorted(l1, reverse=True)
s = sum(l1) / 2
for i in range(n):
	S = sum(l2[0:i + 1])
	if S > s:
		print(i + 1)
		break


def divide_coins(numCoins, coins):
	coins.sort(reverse=True)
	total_sum = sum(coins)
	cur_sum = 0
	captured_coin = 0
	for coin in coins:
		if cur_sum <= total_sum - cur_sum:
			captured_coin += 1
			cur_sum += coin
		else:
			break
	print(captured_coin)
	return

def input_and_run():
	numCoins = int(input())
	coins = input().split()
	coins = list(map(int, coins))
	divide_coins(numCoins, coins)
input_and_run()


a = int(input())
b = list(map(int, input().split()))
c = sorted(b)
d = sum(b)
rvrs = c[::-1]
e = d / 2
cnt = 0
x = 0
for i in rvrs:
	x += i
	cnt += 1
	if x > e:
		print(cnt)
		exit()


import sys
firstLine = True
numlines = 2
total = 0
i = 0
num = 0
list2 = []
for line in sys.stdin:
	if firstLine:
		numloops = int(line)
		numlines -= 1
		firstLine = False
		continue
	line = line[:len(line) - 1]
	list1 = line.split(' ')
	for i in range(numloops):
		list2.append(int(list1[i]))
	list2 = sorted(list2, reverse=True)
	while total <= sum(list2) / 2:
		total += list2[num]
		num += 1
	numlines -= 1
	if numlines == 0:
		break
print(num)


n = int(input())
x = [int(x) for x in input().split()]
x.sort(reverse=True)
M = sum(x)
N = 0
num = 1
for i in range(len(x)):
	N += x[i]
	if N > M / 2:
		num = num
	else:
		num += 1
print(num)


n = int(input())
f = list(map(int, input().split()))
f.sort(reverse=True)
sm = 0
p = 0
for i in range(n):
	sm += f[i]
for i in range(n):
	p += f[i]
	sm -= f[i]
	if p > sm:
		print(i + 1)
		break


n = int(input())
a = list(map(int, input().split()))
s = sum((a[i] for i in range(n)))
for i in range(1, n):
	for j in range(1, n + 1 - i):
		if a[j] > a[j - 1]:
			b = a[j - 1]
			a[j - 1] = a[j]
			a[j] = b
t = i = 0
while 2 * t <= s:
	t += a[i]
	i = i + 1
print(i)


n = int(input())
l = list(map(int, input().split()))
rem = total = sum(l)
you = 0
i = 0
l.sort(reverse=True)
while i < n and you <= rem:
	you += l[i]
	rem = total - you
	i += 1
print(i)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
(v, cnt, sm) = (0, 0, sum(a) // 2)
for el in a:
	if v <= sm:
		v += el
		cnt += 1
print(cnt)


n = int(input())
coin = list(map(int, input().split()))
coin.sort(reverse=True)
mine = 0
cnt = 0
while mine <= sum(coin):
	mine += coin[0]
	cnt += 1
	coin.pop(0)
print(cnt)


n = input()
values = sorted([int(x) for x in input().split()], reverse=True)
minValue = sum(values) / 2
s = []
for x in range(0, len(values) + 1):
	if sum(s) <= minValue:
		s.append(values[x])
	else:
		print(len(s))
		break


n = int(input())
line = [int(i) for i in input().split()]
line.sort(reverse=True)
mine = 0
total = sum(line)
count = 0
for i in range(n):
	mine += line[i]
	total += -line[i]
	count += 1
	if mine > total:
		print(count)
		break


group = int(input())
s = [int(x) for x in input().split()]
mine = 0
d = 0
s.sort(reverse=True)
ping = int(sum(s) / 2)
for m in s:
	mine = mine + int(m)
	d = d + 1
	if mine > ping:
		break
print(d)


n = int(input())
list1 = list(input().split())
coins_set = list(map(int, list1))
sum_coins = sum(coins_set)
set_seq = sorted(coins_set, reverse=True)
sum_me = 0
k = 0
for m in range(0, n):
	sum_me += set_seq[m]
	k += 1
	if sum_me > sum_coins / 2:
		break
print(k)


operations_list = []
n = int(input())
nums = list(map(int, input().split()))
nums.sort(reverse=True)
i = 0
while i == 0:
	operations_list.append(nums[0])
	nums.pop(0)
	if sum(operations_list) > sum(nums):
		break
print(len(operations_list))


n = int(input())
l = list(map(int, input().split()))
ls = sum(l)
l.sort(reverse=True)
v = ls / 2
(su, c) = (0, 0)
for i in l:
	su += i
	c += 1
	if su > v:
		break
print(c)


n = input()
a = list(map(int, input().split()))
c = []
count = 0
while sum(c) <= sum(a):
	c.append(max(a))
	a.remove(max(a))
	count += 1
print(count)


def coins():
	n = int(input())
	a = sorted(list(map(int, input().split())))
	a.reverse()
	x = []
	r = 0
	while sum(x) < sum(a):
		x.append(a[0])
		a.remove(a[0])
		r += 1
	if sum(x) == sum(a):
		r += 1
	return r
print(coins())


c = int(input())
L = list(map(int, input().split()))
L.sort(reverse=True)
s = sum(L)
i = 0
a = 0
while i <= s:
	i += L[a]
	s -= L[a]
	a += 1
print(a)


k = int(input())
costs = [int(i) for i in input().split(' ')]
costs = sorted(costs, reverse=True)
for i in range(0, k):
	if sum(costs[0:i + 1]) > sum(costs[i + 1:]):
		print(len(costs[0:i + 1]))
		break


n = int(input())
lst = [int(x) for x in input().split()]
lst.sort()
b = 0
lenlst = len(lst)
for i in range(len(lst)):
	b = b + lst.pop()
	if b > sum(lst):
		break
print(lenlst - len(lst))


n = int(input())
a = [int(x) for x in input().split()]
a = sorted(a)[::-1]
tot = 0
c = 0
for i in range(len(a)):
	if tot <= sum(a[i:]):
		tot += a[i]
		c += 1
	else:
		break
print(c)


input()
coins = sorted(map(lambda x: int(x), input().split(' ')))
c_sum = sum(coins)
i = 0
j = len(coins) - 1
val = 0
while val <= c_sum - val:
	val += coins[j]
	j -= 1
	i += 1
print(i)


def twins(coinList):
	coinDict = {}
	bigNum = 0
	myCoinSum = 0
	coinSum = 0
	coinCount = 0
	for coin in coinList:
		if coin not in coinDict:
			coinDict[coin] = 0
		coinDict[coin] += 1
		coinSum += coin
		if coin > bigNum:
			bigNum = coin
	while bigNum > 0:
		coinDict[bigNum] -= 1
		coinCount += 1
		coinSum -= bigNum
		myCoinSum += bigNum
		if coinDict[bigNum] == 0:
			bigNum -= 1
			while bigNum not in coinDict:
				if bigNum == 0:
					return coinCount
				bigNum -= 1
		if myCoinSum > coinSum:
			return coinCount
numCoins = input()
coinList = [int(x) for x in input().split()]
print(twins(coinList))


input()
nums = sorted(map(int, input().split()), reverse=True)
s = sum(nums) / 2
(m, i) = (0, 0)
while m <= s:
	m += nums[i]
	i += 1
print(i)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
b = 0
x = sum(arr)
y = 0
for i in range(n - 1, -1, -1):
	x -= arr[i]
	y += arr[i]
	b += 1
	if y > x:
		print(b)
		break


n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
allof = 0
for i in range(n):
	allof += a[i]
before = 0
count = 0
for i in range(n):
	while before <= allof - before:
		before += a[i]
		count += 1
		break
print(count)


n = int(input())
a = sorted([int(i) for i in input().split()])
m = int(sum(a) / 2) + 1
s = 0
i = 1
while s < m:
	s += a[-i]
	i += 1
print(i - 1)


n = int(input())
ln = list(map(int, input().split()))
ln.sort(reverse=True)
sum = 0
c = 0
for i in range(n):
	sum += ln[i]
mv = 0
for i in range(n):
	mv += ln[i]
	if mv > sum // 2:
		print(i + 1)
		break


n = input()
m = input()
m = [int(i) for i in m.split()]
m = sorted(m)[::-1]
for i in range(len(m)):
	if sum(m[:i + 1]) > sum(m[i + 1:]):
		print(len(m[:i + 1]))
		break


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
sc = 0
s = 0
c = 0
for i in range(n):
	s += l[i]
for i in range(n):
	sc += l[i]
	c += 1
	if sc > s // 2:
		print(c)
		exit()
print(c)


n = int(input())
lst = []
v = input()
lst = v.split()
lst.sort(key=int)
x = len(lst)
s = 0
for i in range(0, x):
	s = s + int(lst[i])
for i in range(x - 1, -1, -1):
	sum1 = 0
	sum2 = 0
	for j in range(0, i, 1):
		sum2 = sum2 + int(lst[j])
	sum1 = s - sum2
	if sum1 > sum2:
		break
print(x - i)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
x = sum(a)
taken = 0
money = 0
i = 0
while 2 * money <= x:
	taken += 1
	money += a[i]
	i += 1
print(taken)


n = int(input())
coins = sorted([int(i) for i in input().split()])
brother = sum(coins)
me = 0
res = 0
while me <= brother:
	me += coins.pop()
	brother = sum(coins)
	res += 1
print(res)


n = int(input())
coins = list(map(int, input().split()))
coins = sorted(coins)
t_sum = 0
cmp = sum(coins)
k = 0
while t_sum <= cmp - t_sum:
	t_sum += coins[n - k - 1]
	k += 1
print(k)


t = int(input())
d = list(map(int, input().split()))
s = sum(d)
d.sort(reverse=True)
count = 0
a = 0
while a <= s // 2:
	a += d[count]
	count += 1
print(count)


n = int(input())
nums = sorted(map(lambda x: int(x), input().split(' ')), reverse=True)
count = 0
ss = sum(nums)
s = 0
for x in nums:
	count += 1
	s += x
	if ss - s < s:
		break
print(count)


n = int(input())
l1 = []
su = 0
b = 0
l1 = [int(i) for i in input().split()]
l1.sort(reverse=True)
for i in range(n):
	su = su + l1[i]
for i in range(n):
	b = b + l1[i]
	if su - b < b:
		print(i + 1)
		break


a = int(input())
ed = input().split()
c = []
e = 0
for i in range(a):
	b = int(ed[i])
	c.append(b)
	e += b
g = sorted(c, reverse=True)
d = 0
f = 0
h = 0
while d < int(e / 2) + 1:
	d += g[f]
	h += 1
	f += 1
print(h)


import math
n = int(input())
ls = [int(x) for x in input().split(' ')]
ls.sort(reverse=True)
total = sum(ls)
share = math.floor(total / 2)
chksum = 0
num_coins = 0
for i in range(1, n + 1):
	for j in range(i):
		chksum = chksum + ls[j]
	if chksum > share:
		num_coins = j + 1
		break
	else:
		chksum = 0
print(num_coins)


n = input()
a = list(map(int, input().split()))
s = sum(a) // 2
(mc, lm) = (0, 0)
for (i, j) in enumerate(reversed(sorted(a))):
	lm += j
	mc += 1
	if lm > s:
		break
print(mc)


from copy import deepcopy
x = int(input())
y = input()
y = y.split(' ')
for i in range(len(y)):
	y[i] = int(y[i])
y.sort(reverse=True)

def sumy(a, m, n):
	s = 0
	for i in range(m, n + 1):
		s = s + a[i]
	return s
for j in range(len(y)):
	sum1 = sumy(y, 0, j)
	sum2 = sumy(y, j + 1, len(y) - 1)
	if sum1 > sum2:
		k = j + 1
		print(k)
		break


n = int(input())
a = [int(i) for i in input().split(' ')]
take = []
i = 0
while i < len(a):
	j = i + 1
	while j < len(a):
		if int(a[i]) > int(a[j]):
			(a[i], a[j]) = (a[j], a[i])
		j += 1
	i += 1
while sum(a) >= sum(take):
	take.append(a[len(a) - 1])
	a.pop(len(a) - 1)
print(len(take))


n = int(input())
coins = list(map(int, input().strip().split()))
coins = sorted(coins)
x = []
i = 1
while sum(x) <= sum(coins) / 2:
	x.append(coins[-i])
	i += 1
print(len(x))


number = int(input())
values = input()
value_list = []
for value in values.split(' '):
	value_list.append(int(value))
value_list.sort()
other_side = []
for i in range(len(value_list) - 1, -1, -1):
	if sum(other_side) <= sum(value_list[:i + 1]):
		other_side.append(value_list[i])
print(len(other_side))


from math import *

def twins(length, string):
	array = string.split(' ')
	temp_array = []
	for i in range(int(length)):
		temp = int(array[i])
		temp_array += [int(temp)]
	sums = 0
	array = temp_array
	counter = 0
	mid = sum(array) / 2
	array = sorted(array, reverse=True)
	for i in array:
		sums += i
		counter += 1
		if sums > mid:
			break
	print(counter)
length = input()
string = input()
twins(length, string)


test = int(input())
i = 0
li = []
s = input()
t = s.split(' ')
while i < test:
	a = int(t[i])
	li.append(a)
	i += 1
x = sorted(li, reverse=True)
s = 0
til = sum((i for i in x))
til = til // 2
i = 0
while s <= til:
	s += x[i]
	i += 1
print(i)


n = int(input())
d = list(map(int, input().split()))
d.sort()
sum = 0
dsum = 0
for i in range(n):
	sum += d[i]
k = 0
while k < len(d):
	sum -= d[k]
	dsum += d[k]
	if dsum >= sum:
		print(n - k)
		break
	k += 1


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
b = a[::-1]
asum = sum(a)
c = 0
bsum = 0
for i in b:
	bsum += i
	c += 1
	if bsum > asum // 2:
		break
print(c)


num = int(input())
coins = [int(s) for s in input().split()]
coins.sort(reverse=True)
coin_count = 0
sum_coins = sum((s for s in coins))
total = 0
while total <= sum_coins / 2:
	total += coins[coin_count]
	coin_count += 1
print(coin_count)


n = int(input())
cvals = [int(i) for i in input().split()]
cvals.sort(reverse=True)
total = sum(cvals)
x = 1
while sum(cvals[:x]) <= total / 2:
	x += 1
print(x)


a = int(input())
i = 0
c = input()
b = []
while i < a:
	b.append(int(c.split(' ')[i]))
	i = i + 1
b.sort(reverse=True)
dif = sum(b) / 2
sum = 0
i = 0
while i < a:
	sum = sum + b[i]
	if sum > dif:
		print(i + 1)
		break
	i = i + 1


n = int(input())
nom = list(map(int, input().split()))
m = 0
s = 0
f = sum(nom) / 2
for i in range(n):
	a = max(nom)
	s += a
	m += 1
	if s > f:
		break
	else:
		b = nom.index(max(nom))
		nom.remove(nom[b])
print(m)


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a, reverse=True)
	total = a[0]
	count = 1
	for i in range(1, n):
		if total > sum(a[i:]):
			break
		total += a[i]
		count += 1
	print(count)
solve()


n = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
total = sum(arr)
ans = 0
taken = 0
for i in range(n):
	taken += arr[i]
	rem = total - taken
	ans += 1
	if taken > rem:
		break
print(ans)


input()
word = input()
nums = word.split(' ')
for i in range(len(nums)):
	nums[i] = int(nums[i])
sums = int(sum(nums) / 2)
nums.sort(reverse=True)
result = 0
temp = 0
for i in nums:
	temp += i
	result += 1
	if temp > sums:
		break
print(result)


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


n = int(input())
a = input().split()
b = []
c = []
s = 0
for i in a:
	i = int(i)
	b.append(i)
b.sort(reverse=True)
ave = sum(b) // 2 + 1
for i in range(len(b)):
	s = s + b[i]
	if s >= ave:
		c.append(i + 1)
print(min(c))


coin = int(input())
coins = list(map(int, input().split()))
t = picked = 0
while sum(coins) >= picked:
	picked += coins.pop(coins.index(max(coins)))
	t += 1
print(t)


n = int(input())
l = sorted(list(map(int, input().split())), reverse=True)
i = 0
p = 0
if n == 1:
	p = 1
while i < n:
	if sum(l[:i + 1]) > sum(l[i + 1:]):
		p = i + 1
		break
	i += 1
print(p)


n = int(input())
x = list(map(int, input().split()))
x.sort()
c = 0
soma = 0
while True:
	removida = x.pop(-1)
	soma += removida
	c += 1
	if soma > sum(x):
		print(c)
		break


n = input()
coins = list(map(int, input().split()))
coins = sorted(coins)
for i in range(1, len(coins)):
	coins[i] += coins[i - 1]
p = False
amount = 0
j = 0
for i in range(len(coins) - 1, 0, -1):
	j += 1
	amount += coins[i] - coins[i - 1]
	if amount > coins[i - 1]:
		p = True
		print(j)
		break
if not p:
	print(len(coins))


number_of_coins = input()
coin_values = input()
coins = list(map(int, coin_values.split(' ')))
coins_taken = 0
my_total = 0
brother_total = sum(coins)
coins = sorted(coins, reverse=True)
while my_total <= brother_total:
	coin = coins.pop(0)
	my_total += coin
	brother_total -= coin
	coins_taken += 1
print(coins_taken)


arg = int(input())
l1 = list(map(int, input().strip().split()))
l1.sort()
l1.reverse()
res = 0
s = sum(l1)
k = 0
counter = 0
while True:
	s -= l1[counter]
	k += l1[counter]
	counter += 1
	res += 1
	if k > s:
		print(res)
		break


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

def summation(values):
	total = 0
	for value in values:
		total += value
	return total

def main():
	values.sort(reverse=True)
	for minimum in range(0, len(values)):
		if summation(values[:minimum + 1]) > summation(values) / 2:
			print(minimum + 1)
			break
	return 0
if __name__ == '__main__' and len(values) == n:
	main()
else:
	print('please enter ' + str(n) + ' values')


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
s1 = l[0]
s2 = sum(l[1:])
c = 1
i = 1
while True:
	if s1 > s2:
		print(c)
		break
	else:
		s1 += l[i]
		s2 = sum(l[i + 1:])
		c += 1
		i += 1
else:
	print(c)


n = int(input())
l = list(map(int, input().split()))
l.sort()
s = sum(l)
s /= 2
s2 = 0
i = 0
while s2 <= s:
	i += 1
	s2 += l.pop()
print(i)


n = int(input())
a = input().split()
a = [int(i) for i in a]
s = 0
s1 = 0
count = 0
for j in range(0, n):
	s = s + int(a[j])
s = s // 2
a.sort(reverse=True)
for k in range(0, n):
	if s1 > s:
		break
	else:
		s1 = s1 + int(a[k])
		count = count + 1
print(count)


a = input()
b = input()
min_coin = int(a)
c = b.split()
c.sort(key=float)
total_sum = 0
for i in c:
	total_sum += int(i)
sum = 0
x = int(a) - 1
count = 0
while 2 * sum <= total_sum:
	sum += int(c[x])
	x -= 1
	count += 1
print(count)


n = int(input())
na = input().split()
na = [int(i) for i in na]
tot = sum(na)
share = 0
coins = 0
while share <= tot / 2:
	temp = max(na)
	na.pop(na.index(temp))
	share = share + temp
	coins += 1
print(coins)


pos = int(input())
n = list(map(int, input().rstrip().split()))
suma = int(sum(n) / 2)
n.sort(reverse=True)
coins = 0
money = 0
for i in n:
	if money > suma:
		break
	else:
		money += i
		coins += 1
print(coins)


n = int(input())
arr = sorted([int(x) for x in input().split()])
c = s = 0
while s <= sum(arr):
	s += arr.pop()
	c += 1
print(c)


n = int(input())
coins = [int(x) for x in input().split()]
coins.sort(reverse=True)
tmoney = sum(coins)
mymoney = 0
count = 0
for i in range(n):
	count += 1
	mymoney += coins[i]
	if mymoney > tmoney - mymoney:
		break
print(count)


num_coins = input()
coins = input().split()
int_coins = []
for coin in coins:
	int_coins.append(int(coin))
int_coins.sort(reverse=True)
taken_coins = 1
taken_sum = int_coins[0]
done = False
while done == False:
	sum_c = 0
	for i in range(taken_coins, len(int_coins)):
		sum_c += int_coins[i]
	if taken_sum > sum_c:
		done = True
	else:
		taken_sum += int_coins[taken_coins]
		taken_coins += 1
print(taken_coins)


def prog():
	n = int(input())
	mas = list(map(int, input().split()))
	mas.sort()
	mas.reverse()
	(a, k) = (0, 0)
	while a <= sum(mas):
		a += mas[0]
		k += 1
		mas.pop(0)
	print(k)
prog()


r = int(input())
mas = [int(i) for i in input().split()]
sum_of_mas = sum(mas)
sum_of_mas //= 2
mas.sort(reverse=True)
my_sum = 0
i = 0
while my_sum <= sum_of_mas:
	my_sum += mas[i]
	i += 1
print(i)


n = int(input())
v = list(map(int, input().split(' ')))
for i in range(n):
	for j in range(n):
		if v[j] < v[i]:
			c = v[j]
			v[j] = v[i]
			v[i] = c
t = 0
for i in range(n):
	t = t + v[i]
	if t > sum(v) - t:
		nc = i + 1
		break
print(nc)


n = int(input())
a = list(map(int, input().split()))
x = sum(a)
y = 0
count = 0
while y <= x:
	y += max(a)
	x = x - max(a)
	a.remove(max(a))
	count += 1
print(count)


numOfCoins = int(input())
values = sorted([int(x) for x in input().split()])[::-1]
lastTaken = 1
while sum(values[:lastTaken]) <= sum(values[lastTaken:]):
	lastTaken += 1
print(lastTaken)


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
s = l[0]
c = 1
k = 1
for i in range(1, len(l)):
	if s > sum(l[i:]):
		k = 0
		print(c)
		break
	else:
		s += l[i]
		c += 1
if k == 1:
	print(c)


n = int(input())
l = list(map(int, input().split()))
(t1, t2) = (0, sum(l))
l.sort(reverse=True)
count = 0
for i in range(n):
	t1 += l[i]
	t2 -= l[i]
	if t1 > t2:
		print(i + 1)
		break


n = int(input())
a = map(int, list(input().split(' ')))
a = sorted(a)
x = 0
z = -1
y = sum(a)
while x <= y:
	x += a[z]
	y -= a[z]
	z -= 1
print(abs(z) - 1)


n = int(input())
istr = input().split()
iarr = []
for i in range(0, n):
	iarr.append(int(istr[i]))
imin = 0
for i in range(0, n):
	imin += iarr[i]
imin /= 2
sof = 0
tnof = 0
iarr.sort(reverse=True)
for i in range(0, n):
	if sof > imin:
		break
	sof += iarr[i]
	tnof += 1
print(tnof)


n = int(input())
l = list(map(int, input().split()))
su = sum(l)
l.sort(reverse=True)
(c, x) = (0, 0)
for i in l:
	if x <= su:
		x += i
		su -= i
		c += 1
	else:
		break
print(c)


q = int(input())
s = list(map(int, input().split()))
s.sort()
s = s[::-1]
a = sum(s) / 2
i = 0
while sum(s) >= a:
	i += 1
	del s[0]
print(i)


n = int(input(''))
coins = [int(coin) for coin in input('').split()]
coins = sorted(coins)
count = 1
mine = 0
for i in range(n - 1, -1, -1):
	his = 0
	mine = mine + coins[i]
	for j in range(0, i):
		his = his + coins[j]
	if mine > his:
		break
	else:
		count += 1
print(count)


import math
n = int(input())
r = [int(x) for x in input().split()]
r.sort(reverse=True)
l = r
k = []
s = sum(l)
num = 0
for i in range(n):
	if sum(k) > s / 2:
		break
	else:
		k.append(l[i])
		num += 1
print(num)


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
twin_sum = sum(coins)
my_sum = 0
my_coins = 0
for coin in coins:
	if my_sum <= twin_sum:
		my_coins += 1
		my_sum += coin
		twin_sum -= coin
	else:
		break
print(my_coins)


n1 = input()
n = list(map(int, input().split()))
n.sort(reverse=True)
summ_n = sum(n)
summ_1 = 0
k = 0
for i in range(len(n)):
	summ_1 += n[i]
	k += 1
	if summ_1 > summ_n / 2:
		break
print(k)


n = int(input())
x = list(map(int, input().split()[:n]))
x.sort(reverse=True)
total = 0
tot1 = 0
count = 0
for i in x:
	total += i
for c in x:
	if tot1 <= total:
		tot1 += c
		total -= c
		count += 1
	elif tot1 > total:
		break
print(count)


n = input()
arr = sorted([int(i) for i in input().split()], reverse=True)
total = sum(arr)
twin = 0
i = 0
while i < len(arr) and twin <= total / 2:
	twin += arr[i]
	i += 1
print(i)


n = input()
a = list(map(int, input().split()))
a = sorted(a)
b = 0
c = 0
d = 0
for i in a:
	b += i
for i in a[::-1]:
	c += i
	d += 1
	if c > b / 2:
		break
print(d)


n = int(input())
values = sorted([int(x) for x in input().split()])
total = sum(values)
mine = 0
for i in range(n - 1, -1, -1):
	mine += values[i]
	if mine > total / 2:
		print(len(values) - i)
		break


n = int(input())
a = map(int, input().split())
a = list(a)
a = sorted(a, reverse=True)
sumMy = 0
sumBr = 0
qt = 0
for i in range(len(a)):
	if sumMy <= sumBr:
		sumMy = sumMy + a[i]
		sumBr = sum(a[i + 1:])
		qt = qt + 1
print(qt)


import bisect
(n, a, s) = (int(input()), sorted(map(int, input().split()), reverse=1), 0)
sm = sum(a)
for i in range(1, n):
	a[i] += a[i - 1]
print(bisect.bisect(a, sm // 2) + 1)


n = int(input())
x = list(map(int, input().split()))
x.sort(reverse=True)
l = 0
su = 0
total = sum(x)
for i in range(0, n):
	su = su + x[i]
	total = total - x[i]
	if su > total:
		print(i + 1)
		l = 1
		break
	else:
		continue
if l != 1:
	print(n)


n = int(input())
list1 = [int(x) for x in input().split()]
list1.sort()
list1.reverse()
count = 0
for i in range(n):
	count += 1
	if sum(list1[:i + 1]) > sum(list1[i + 1:]):
		break
print(count)


def CF106A():
	N = int(input())
	arr = list(map(int, input().split()))
	total = sum(arr) / 2
	curr = 0
	arr = sorted(arr, reverse=True)
	for i in range(N):
		curr += arr[i]
		if curr > total:
			return i + 1
res = CF106A()
print(res)


def Max(hhh):
	Max = hhh[0]
	Maxi = 0
	for x in range(1, len(hhh)):
		if hhh[x] > Max:
			Max = hhh[x]
			Maxi = x
	return [Max, Maxi]
n = int(input())
coins = [int(x) for x in input().split()]
sum = 0
for x in coins:
	sum += x
sum2 = 0
number = 0
while True:
	if sum2 > sum - sum2:
		print(number)
		break
	maxarray = Max(coins)
	coins[maxarray[1]] = -1
	sum2 += maxarray[0]
	number += 1


n = int(input())
l = list(map(int, input().split()))[:n]
l.sort(reverse=True)
sum = 0
r = 0
for i in range(n):
	sum = sum + l[i]
k = sum // 2
for i in range(n):
	r = r + l[i]
	if r > k:
		print(i + 1)
		break


n = int(input())
l = list(map(int, input().split()))
l.sort()
rl = l[::-1]

def sum(l):
	s = 0
	for i in l:
		s += i
	return s
ll = []
for i in range(len(l)):
	if sum(l[:i]) < sum(l[i:]):
		ll.append(len(l[i:]))
ll.sort()
print(min(ll))


from sys import stdin
a = [int(x) for x in stdin.read().rstrip().split()]
n = a[0]
coins = a[1:]
coins.sort(reverse=True)
counter = 0
coinsTaken = 0
coinsInPile = sum(coins)
while coinsTaken <= coinsInPile:
	coinsTaken += coins.pop(0)
	coinsInPile = sum(coins)
	counter += 1
print(counter)


n = int(input())
a = [int(i) for i in input().split()]
a = sorted(a, reverse=True)
nsum = sum(a)
ncount = 0
pick = 0
for i in a:
	ncount += 1
	pick += i
	if nsum - pick < pick:
		break
print(ncount)


def twins():
	if not int(input()):
		return 0
	coins = sorted(input().split(' '), key=lambda x: int(x))
	total_money = sum([int(coin) for coin in coins])
	min_coins = 0
	partial_sum = 0
	for coin in coins[::-1]:
		partial_sum += int(coin)
		min_coins += 1
		if partial_sum > total_money // 2:
			return min_coins
print(twins())


n = input()
a = list(map(int, input().split()))
summa = sum(a) / 2
count = 0
cont = 0
a.sort()
a.reverse()
for i in a:
	if cont <= summa:
		cont += i
		count += 1
print(count)


min_coins = 0
total_coins = 0
number_coins = int(input())
value_coins = input().split()

def sum_coins(number_coins):
	all_coins = []
	for x in range(number_coins):
		number = int(value_coins[x])
		all_coins.append(number)
	return all_coins
coins = sum_coins(number_coins)
coins.sort()
while True:
	total_coins += coins.pop()
	min_coins += 1
	total = 0
	for x in range(len(coins)):
		total += coins[x]
	if total < total_coins:
		break
print(min_coins, end='')


newlist = []
int(input())
x = input()
inputlist = [int(item) for item in x.split()]
inputlist.sort(reverse=True)
y = 0
for item in inputlist:
	if y <= sum(inputlist) / 2:
		y = y + item
		newlist.append(y)
print(len(newlist))


n = int(input())
money = sorted(list(map(int, input().split())), reverse=True)
Ch2 = sum(money)
Ch1 = 0
i = 0
while Ch1 <= Ch2:
	Ch2 -= money[i]
	Ch1 += money[i]
	i += 1
print(i)


n = input()
a = list(map(int, input().split()))
a.sort(reverse=True)
m = 0
for i in range(len(a)):
	m = m + a[i]
c = 0
d = 0
while c < len(a) and d * 2 <= m:
	d = d + a[c]
	c += 1
print(c)


n = int(input())
a = list(map(int, input().split()))
b = []
d = [0] * 101
for i in range(len(a)):
	d[a[i]] += 1
while sum(b) <= sum(a) / 2:
	m = 0
	for i in range(len(a)):
		if a[i] > a[m] and d[a[i]] != 0 or d[a[m]] == 0:
			m = i
	b.append(a[m])
	d[a[m]] -= 1
print(len(b))


n = int(input())
a = sorted([int(x) for x in input().split()], reverse=True)
(num, f) = (0, [0])
s = sum(a) // 2 + 1
for i in range(n):
	if sum(f) < s:
		f.append(a[i])
		num += 1
	else:
		num += 0
print(num)


tC = int(input())
coins = list(map(int, input().split()))
count = 0
currBal = 0
coins.sort()
tot = sum(coins)
for x in range(tC):
	if currBal > tot // 2:
		break
	else:
		current = tC - 1 - x
		currBal += coins[current]
		count += 1
print(count)


n = int(input())
str1 = input()
list1 = str1.split(' ')
list1 = [int(x) for x in list1]
list1.sort(reverse=True)
sum0 = 0
slist = []
for i in range(0, n):
	sum0 += int(list1[i])
	slist.append(sum0)
for k in range(0, n):
	if slist[k] / sum0 > 0.5:
		print(k + 1)
		break


n = int(input())
a = []
sum = 0
temp = 0
a = list(map(int, input().split(' ')))
a.sort(reverse=True)
for i in range(0, n):
	sum = sum + a[i]
for j in range(0, n):
	temp = temp + a[j]
	diff = sum - temp
	if temp > diff:
		print(j + 1)
		break
	elif temp == diff:
		print(j + 2)
		break


n = int(input())
l = sorted(map(int, input().split()), reverse=True)
my = 0
r = sum(l)
i = 0
while my <= r:
	my += l[i]
	r -= l[i]
	i += 1
print(i)


n = int(input())
lis = sorted(list(map(int, input().split())), reverse=True)
cnt = 0
i = 0
while i < len(lis):
	if sum(lis[:i + 1]) > sum(lis[i + 1:]):
		cnt += 1
		break
	else:
		cnt += 1
		i += 1
print(cnt)


n = int(input())
c = input().split()
c = [int(x) for x in c]
c.sort(reverse=True)
sumc = 0
for i in c:
	sumc += i
coins = 0
sumc = sumc / 2
sumb = 0
for i in c:
	sumb += i
	coins += 1
	if sumb > sumc:
		break
print(coins)


def cal_coins(a, t):
	a.sort(reverse=True)
	tot_money = sum(a)
	c = 0
	my_money = 0
	for i in range(0, t + 1):
		if my_money > tot_money:
			print(c)
			break
		else:
			my_money = my_money + a[i]
			tot_money = tot_money - a[i]
			c += 1
t = int(input())
a = list(map(int, input().split(' ')))
cal_coins(a, t)


n = int(input())
N = sorted(map(int, input().split()), reverse=True)
s = 0
c = 0
for i in N:
	s += i
	c += 1
	if s > sum(N) / 2:
		break
print(c)


n = int(input())
money = input().split()
money_sorted = []
for i in range(n):
	money_sorted.append(int(money[i]))
money_sorted.sort()
x = 0
y = 0
for i in range(n):
	x += money_sorted[n - (i + 1)]
	y += 1
	if x > sum(money_sorted) - x:
		break
print(y)


n = int(input())
list_ = list(map(int, input().split()))
list_.sort()
count = 0
sum_ = sum(list_)
sum_1 = 0
for i in range(len(list_)):
	sum_1 += list_[len(list_) - i - 1]
	count += 1
	if sum_1 > sum_ // 2:
		break
print(count)


n = int(input())
lst = list(map(int, input().split()))
lst.sort()
count = 0
s = 0
i = len(lst) - 1
while i >= 0:
	s = s + lst[i]
	count = count + 1
	if s > sum(lst) / 2:
		break
	i = i - 1
print(count)


n = int(input())
count_my_money = 0
money = list(map(int, input().split()))
money.sort(reverse=True)
(my_sum, twins_sum) = (0, sum(money))
for i in money:
	my_sum += i
	count_my_money += 1
	twins_sum -= i
	if my_sum > twins_sum:
		print(count_my_money)
		break


N = int(input())
coins = [int(i) for i in input().split(' ')]
coins.sort(reverse=True)
ans = tot = 0
sumi = sum(coins)
half = sumi / 2
for i in range(N):
	tot += coins[i]
	ans += 1
	if tot > half:
		break
print(ans)


n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
summ = 0
count = []
for i in range(n):
	if summ <= sum(a[i:]):
		summ += a[i]
		count.append(a[i])
print(len(count))


no_of_coins = int(input())
coins = input()
coins = coins.split()
coins = [int(x) for x in coins]
coins.sort(reverse=True)
s = sum(coins)
suma = 0
count = 0
for j in coins:
	suma += j
	count += 1
	rem = s - suma
	if suma > rem:
		break
print(count)


in1 = int(input())
in2 = input()
p = in2.split(' ')
sum2 = 0
count1 = 1
for i in range(len(p)):
	p[i] = int(p[i])
max1 = max(p)
sum2 = int(max1)
while 1:
	sum1 = 0
	p.remove(max1)
	for i in p:
		sum1 = sum1 + int(i)
	if sum1 >= sum2:
		count1 = count1 + 1
		max1 = max(p)
		sum2 = sum2 + int(max1)
	else:
		break
print(count1)


n = input()
str = input()
arr = list(map(int, str.split(' ')))
arr = sorted(arr, reverse=True)
total = sum(arr)
cnt = 0
sub_total = 0
for n in arr:
	if sub_total > total - sub_total:
		break
	else:
		sub_total += n
		cnt += 1
print(cnt)


n = int(input())
l = list(map(int, input().split()))
l.sort()
sum = 0
for i in l:
	sum += i
l.reverse()
p = sum
cnt = 1
for j in l:
	sum = sum - j
	if sum >= p / 2:
		cnt += 1
print(cnt)


input()
a = [int(x) for x in input().split()]
a.sort()
i = len(a) - 1
while sum(a[:i]) >= sum(a[i:]):
	i -= 1
print(len(a) - i)


a = input('')
List = input().split(' ')
List = list(map(int, List))
List.sort()
Mine = []
while sum(Mine) <= sum(List):
	Mine.append(List[-1])
	del List[-1]
print(len(Mine))


from math import ceil
N = int(input())
ip = input().split()
coin = [int(ip[i]) for i in range(N)]
coin.sort(reverse=True)
twin = 0
for c in coin:
	twin += c
cnt = 0
me = 0
for c in coin:
	me += c
	cnt += 1
	twin -= c
	if me > twin:
		break
print(cnt)


n = int(input())
coins = sorted((int(x) for x in input().split()), reverse=True)
sum = sum(coins)
t = 0
for i in range(n):
	t += coins[i]
	if t > sum - t:
		print(i + 1)
		break


s1 = 0
s2 = 0
a = int(input())
s = [int(i) for i in input().split()]
s.sort(reverse=True)
for i in range(len(s)):
	s1 = sum(s[:i + 1])
	s2 = sum(s[i + 1:])
	if s1 > s2:
		print(len(s[:i + 1]))
		break


import sys
from os import path
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def solve():
	n = int(input())
	a = [int(i) for i in input().split()]
	k = (sum(a) + 2) // 2
	a.sort(reverse=True)
	c = 0
	ans = 0
	for i in a:
		c += i
		ans += 1
		if c >= k:
			break
	print(ans)

def main():
	tc = 1
	for case in range(tc):
		solve()
main()


a = int(input())
b = list(map(int, input().split()))
b.sort()
c = sum(b)
d = 0
n = a
x = 0
while c >= d:
	x += 1
	c = sum(b[:n - x])
	d = sum(b[n - x:])
print(x)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
s = sum(a)
i = 0
coins = 1
test = 1
mine = a[0]
while i + 1 < n and test == 1:
	if mine > s - mine:
		test = 0
	else:
		mine += a[i + 1]
		coins += 1
		i += 1
print(coins)


def sol(n, val):
	val.sort(reverse=True)
	s = sum(val)
	tmp_sum = 0
	for j in range(n):
		tmp_sum += val[j]
		s -= val[j]
		if tmp_sum > s:
			return j + 1
	return n
n = int(input().strip())
val = [int(i.strip()) for i in input().split()]
print(sol(n, val))


n = int(input())
l = sorted(list(map(int, input().split())))
s = sum(l)
t = 0
j = 0
while j * 2 <= s:
	t += 1
	j += l.pop()
print(t)


n = int(input())
a = list(map(int, input().split()))
t = sum(a)
(c, s) = (0, 0)
while s <= t - s:
	s += max(a)
	a.remove(max(a))
	c += 1
print(c)


n = input()
n = int(n)
a = input()
a = [int(i) for i in a.split()]
a.sort()
sum = 0
ans = 0
for i in range(n):
	sum += a[i]
for i in range(n - 1, -1, -1):
	ans += a[i]
	if sum / 2.0 < ans:
		print(n - i)
		break


a = int(input())
b = input().split()
c = [int(i) for i in b]
d = sorted(c)
e = d.pop()
f = 1
g = sum(d)
while e <= g and len(d) > 0:
	e = e + d.pop()
	f = f + 1
	g = sum(d)
print(f)


n = int(input())
a = [int(x) for x in input().split()]
s = sum(a)
taken = 0
ans = 0
for x in reversed(sorted(a)):
	ans += 1
	taken += x
	if taken > s - taken:
		break
print(ans)


from collections import deque
n = int(input())
money = deque(sorted([int(x) for x in input().split()]))
s = 0
a = 0
b = sum(money)
for i in range(n):
	if a <= b:
		p = money.pop()
		a += p
		b -= p
		s += 1
print(s)


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
st = 0
yo = 0
co = 0
for i in l:
	st = st + i
for i in l:
	if yo <= st:
		yo = yo + i
		st = st - i
		co = co + 1
	else:
		break
print(co)


ns = input()
n = int(ns)
coins = input().split()
for i in range(len(coins)):
	coins[i] = int(coins[i])
coins.sort()
taken = 0
count = 0
for i in range(n):
	taken = taken + coins.pop()
	count = count + 1
	if taken > sum(coins):
		break
print(count)


from collections import deque, Counter, OrderedDict
from heapq import nsmallest, nlargest
from math import ceil, floor, log, log2, sqrt

def binNumber(n, size=1):
	return bin(n)[2:].zfill(size)

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

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

def ini():
	return int(input())

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

def sti():
	return str(input())
n = ini()
a = iar()
a.sort()
a = a[::-1]
x = sum(a)
y = 0
for i in range(n):
	y += a[i]
	x -= a[i]
	if y > x:
		print(i + 1)
		break


n = int(input())
coins = input().split()
money = []
numbers = 0
for coin in coins:
	money.append(int(coin))
average = sum(money) / 2
while average >= 0:
	average -= max(money)
	money.remove(max(money))
	numbers += 1
print(numbers)


n = input()
lst = [int(i) for i in input().split()]
lst.sort()
j = 0
coin = 0
while coin <= sum(lst):
	j += 1
	coin += lst[-j]
	lst[-j] = 0
print(j)


n = int(input())
coins = input().split()
coins = list(map(int, coins))
coins = sorted(coins)
coins = coins[::-1]
sm = 0
c = 0
for i in range(len(coins)):
	sm += coins[i]
	c += 1
	if sm > sum(coins[i + 1:]):
		break
print(c)


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


def Main():
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	summ = 0
	for i in range(n):
		summ += arr[i]
	ans = 0
	sum2 = 0
	for x in reversed(arr):
		ans += 1
		sum2 += x
		if sum2 > summ - sum2:
			break
	print(ans)
Main()


import bisect
from sys import stdin
input = stdin.readline
INF = 10 ** 9 + 7
MAX = 10 ** 7 + 7
MOD = 10 ** 9 + 7
n = int(input().strip())
a = [int(x) for x in input().strip().split()]
a.sort(reverse=True)
s = 0
sa = sum(a)
for i in range(len(a)):
	s += a[i]
	if s > sa - s:
		print(i + 1)
		break


n = int(input())
l = list(map(int, input().split()))
l.sort()
s = x = 0
list_sum = sum(l)
for i in range(n):
	s += l[n - i - 1]
	x += 1
	if 2 * s > list_sum:
		print(x)
		break


n = int(input())
c = []
add = 0
sum1 = 0
count = 0
x = 0
l = list(map(int, input().split()))
c = sorted(l, reverse=True)
for i in range(0, len(c)):
	count = count + 1
	add = add + c[i]
	x = i + 1
	for j in range(x, len(c), 1):
		sum1 = sum1 + c[j]
	if sum1 < add:
		break
	else:
		sum1 = 0
print(count)


number = int(input())
string = str(input()).split(' ')
list_ = []
for num in range(number):
	list_.append(int(string[num]))
list_.sort(reverse=True)
count_you = 0
for num in range(len(list_)):
	sum_Max = sum(list_) - list_[num]
	if list_[num] > sum_Max:
		count_you += 1
		break
	else:
		middle_index = num
		first_half = list_[:middle_index]
		second_half = list_[middle_index:]
		if sum(first_half) > sum(second_half):
			count_you = len(first_half)
			break
		else:
			count_you = len(list_)
print(count_you)


n = int(input())
list_of_coins = list(map(int, input().split()))
sorted_list_of_coins = sorted(list_of_coins, reverse=True)
sum_total = sum(sorted_list_of_coins)
if sum_total % 2 == 0:
	half_of_total_sum = sum_total / 2
else:
	half_of_total_sum = int(sum_total / 2)
cummulative_sum_of_coins = 0
for (i, coin) in enumerate(sorted_list_of_coins):
	cummulative_sum_of_coins += coin
	if cummulative_sum_of_coins > half_of_total_sum:
		break
print(i + 1)


n = int(input())
li = sorted(list(map(int, input().split())))
li = li[::-1]
x = c = 0
half = sum(li) // 2
for i in li:
	x += i
	c += 1
	if x > half:
		break
print(c)


N = int(input())
A = [int(x) for x in input().split()]
Min = sum(A) / 2
A.sort(reverse=True)
X = A[0]
i = 0
while X <= Min:
	i += 1
	X = X + A[i]
print(int(i + 1))


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
total = sum(coins)
count = 0
taken = 0
while True:
	taken += coins[0]
	count += 1
	total -= coins[0]
	coins = coins[1:]
	if taken > total:
		print(count)
		exit()


n = int(input())
inp = input().split()
l = len(inp)
for i in range(l):
	inp[i] = int(inp[i])
inp = sorted(inp)
sum1 = 0
for i in inp:
	sum1 += i
sum2 = 0
inp = sorted(inp, reverse=True)
for i in range(l):
	sum2 += inp[i]
	sum1 = sum1 - inp[i]
	if sum2 > sum1:
		break
print(i + 1)


n = eval(input())
coins = input().split()
total = 0
for i in range(n):
	coins[i] = eval(coins[i])
	total += coins[i]
coins = sorted(coins)
coins.reverse()
step = 0
for i in range(n):
	step += coins[i]
	if step > total / 2:
		break
print(i + 1)


n = int(input())
coin_vals = list(map(int, input().split()))
coin_vals.sort(reverse=True)
b2 = sum(coin_vals)
b1 = 0
ans = 0
for c in coin_vals:
	b1 += c
	b2 -= c
	ans += 1
	if b1 > b2:
		break
print(ans)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
s1 = 0
s2 = 0
c = 0
for i in range(n - 1, -1, -1):
	s1 += a[i]
	s2 = 0
	c += 1
	for j in range(0, i):
		s2 += a[j]
	if s1 > s2:
		print(c)
		break


n = int(input())
import sys
l = list(map(int, input().split()))
l.sort()
l1 = []
c = 0
for i in l:
	c += i
	l1.append(c)
for i in range(n - 2, -1, -1):
	if l1[-1] - l1[i] > l1[i]:
		print(n - i - 1)
		sys.exit()
print(n)


n = int(input())
noCoins = input().split()
noCoins = [int(noCoins[i]) for i in range(len(noCoins))]
noCoins.sort(reverse=True)
s = 0
if len(noCoins) == 1:
	print('1')
else:
	for i in range(len(noCoins)):
		s += noCoins[i]
		i += 1
		rstsum = sum(noCoins[i:])
		if s > rstsum:
			print(i)
			break


n = int(input())
a = list(map(int, input().split()))
s = 0
for i in a:
	s += i
for i in range(n - 1):
	for j in range(n - 1 - i):
		if a[j] > a[j + 1]:
			(a[j], a[j + 1]) = (a[j + 1], a[j])
(k, l) = (0, 0)
while s >= l:
	l += a[-(k + 1)]
	s -= a[-(k + 1)]
	k += 1
print(k)


n = int(input())
lst = list(map(int, input().split()))
lst.sort()
lst.reverse()
s = 0

def sumRange(L, a, b):
	sum = 0
	for i in range(a, b):
		sum += L[i]
	return sum
for i in range(n):
	s = s + lst[i]
	ss = sumRange(lst, i + 1, n)
	if s > ss:
		break
print(i + 1)


x = int(input())
n = x - 1
emon = []
emon = input().split()
emon1 = []
for i in emon:
	c = int(i)
	emon1.append(c)
emon1.sort()
emon = emon1
p = 0
r = 0
q = 0
r = 0
a = 0
b = 0
for i in range(n, -1, -1):
	p = p + 1
	a = int(emon[i])
	q = a + q
	for l in range(0, i, 1):
		b = int(emon[l])
		r = b + r
	if q > r:
		break
	r = 0
print(p)


t = int(input())
x = list(map(int, input().split()))
s = sum(x)
c = 0
v = 0
x.sort(reverse=True)
for i in range(t):
	c = c + x[i]
	s = s - x[i]
	if c < s or c == s:
		v += 1
	else:
		v += 1
		break
print(v)


import copy

def findLargest():
	largest = 0
	for x in coins:
		if int(x) > largest:
			largest = int(x)
	return int(x)
coins = []
numberOfCoins = int(input())
stringIn = input()
coinsStack = stringIn.split(' ')
coins = []
temp = 0
for i in coinsStack:
	coins.append(int(i))
coins.sort()
coins.reverse()
greedycount = 0
greedy = 0
sleepy = 0
equal = False
if numberOfCoins <= 2:
	if numberOfCoins == 1:
		greedycount = 1
	elif int(coins[0]) == int(coins[1]):
		greedycount = 2
	else:
		greedycount = 1
else:
	while equal == False:
		greedy = 0
		sleepy = 0
		for x in range(0, numberOfCoins - 1, +1):
			sleepy = 0
			greedy += int(coins[x])
			greedycount = greedycount + 1
			for y in range(x + 1, numberOfCoins, +1):
				sleepy += int(coins[y])
			if greedy > sleepy:
				equal = True
				break
print(greedycount)


from sys import stdin

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

def solve(vs):
	tot = sum(vs)
	vs2 = sorted(vs)[::-1]
	running_tot = 0
	count = 0
	for v in vs2:
		running_tot += v
		count += 1
		if running_tot * 2 > tot:
			return count
	return count

def run():
	(n,) = readInts()
	vs = list(readInts())
	print(solve(vs))
run()


N = int(input())
arr = input().split(' ')
for i in range(len(arr)):
	arr[i] = int(arr[i])
arr = sorted(arr)
half = sum(arr) / 2
summ = 0
counter = 0
for j in range(len(arr) - 1, -1, -1):
	if summ <= half:
		summ += arr[j]
		counter += 1
print(counter)


n = int(input())
lst = input()
coins = lst.split()
for i in range(0, len(coins)):
	coins[i] = int(coins[i])
coin = sorted(coins)
coi = []
x = 0
while sum(coi) <= sum(coin):
	x = x + 1
	y = coin.pop()
	coi.append(y)
print(x)


n = int(input())
coins = input()
my_list = coins.split()
for x in range(len(my_list)):
	my_list[x] = int(my_list[x])
my_list.sort(reverse=True)
evilMax = sum(my_list[:1])
max = sum(my_list[1:])
count = 1
for i in range(1, len(my_list) + 1):
	if evilMax > max:
		break
	else:
		evilMax = sum(my_list[:i + 1])
		max = sum(my_list[i + 1:])
		count += 1
print(count)


n = input()
coins = list(map(int, input().split()))
suma = sum(coins)
cur_suma = 0
num = 0
for (i, coin) in enumerate(sorted(coins, reverse=True)):
	cur_suma += coin
	num += 1
	if cur_suma >= suma // 2 + 1:
		break
print(num)


n = input()
arrStr = input().split()
arrInt = list(map(int, arrStr))
sum = 0
for i in arrInt:
	sum += i
arrInt2 = arrInt
arrInt2.sort(reverse=True)
for i in range(1, len(arrInt2)):
	arrInt2[i] = arrInt2[i - 1] + arrInt2[i]
for i in range(0, len(arrInt2)):
	if arrInt2[i] > sum / 2:
		print(i + 1)
		break


n = int(input())
tab = sorted(list(map(int, input().split())))[::-1]
tab_sum = sum(tab)
amount = 0
s = 0
for elem in tab:
	amount += 1
	s += elem
	if 2 * s > tab_sum:
		break
print(amount)


def main():
	num_coins = int(input())
	values = [int(i) for i in input().split(' ')]
	total = sum(values)
	values.sort(reverse=True)
	s = 0
	i = 0
	while s <= total // 2:
		s += values[i]
		i += 1
	print(i)
main()


n = int(input())
coins = [int(x) for x in input().split()]
coins.sort(reverse=True)
sum_coins = sum(coins)
coins_num = 0
sum_c = 0
for c in coins:
	if sum_c > sum_coins / 2:
		break
	coins_num += 1
	sum_c += c
print(coins_num)


n = int(input())
c = list(map(int, input().split()))
c.sort(reverse=True)
cnt = 0
flag = False
for i in range(n):
	if sum(c[:i]) > sum(c[i:]):
		print(cnt)
		flag = True
		break
	else:
		cnt += 1
if flag == False:
	print(cnt)
else:
	pass


n = int(input())
arr = input().split(' ')
for i in range(n):
	arr[i] = int(arr[i])
arr.sort()
s = sum(arr)
s = s / 2
a = True
temp = n
count = 0
while a == True:
	if count > s:
		a = False
	count += arr[n - 1]
	n = n - 1
print(temp - n - 1)


n = int(input())
l = [int(x) for x in input().split()]
l.sort(reverse=True)
lg = len(l)
sum1 = 0
s = sum(l)
j = 0
for i in range(lg):
	while sum1 <= s - sum1:
		sum1 += l[j]
		j += 1
print(j)


import os
from sys import stdin, stdout

def solve(tc):
	n = int(stdin.readline().strip())
	seq = list(map(int, stdin.readline().split()))
	seq = sorted(seq, reverse=True)
	remain = 0
	for i in range(n):
		remain += seq[i]
	ans = 0
	pick = 0
	for i in range(n):
		pick += seq[i]
		remain -= seq[i]
		ans += 1
		if pick > remain:
			break
	print(ans)
tcs = 1
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


a = int(input())
x = -1
y = 0
z = 0
w = 0
n = 0
c = 0
if 1 <= a <= 100:
	b = input().split()
	while c < len(b):
		b[c] = int(b[c])
		c = c + 1
	b.sort()
	while y < len(b):
		z = z + int(b[y])
		y = y + 1
	while x >= -len(b):
		w = w + int(b[x])
		if w > int(z / 2):
			n = -x
			break
		x = x - 1
print(n)


def EliMayor(A):
	Mayor = -1
	for K in range(len(A)):
		X = int(A[K])
		if X > Mayor:
			Mayor = X
	NA = []
	Cont = 0
	for J in range(len(A)):
		if Cont == 0:
			Y = int(A[J])
			if Y != Mayor:
				NA = NA + [Y]
			else:
				Cont = 1
		else:
			NA = NA + [A[J]]
	return (Mayor, NA)

def Suma(A):
	Sum = 0
	for K in range(len(A)):
		X = int(A[K])
		Sum = Sum + X
	return Sum
N = int(input(''))
M = input('')
M = M.split()
Cont = 0
H = 0
for K in range(len(M)):
	(May, M) = EliMayor(M)
	H = H + May
	G = Suma(M)
	if H > G:
		Cont = Cont + 1
		break
	else:
		Cont = Cont + 1
print(Cont)


u = int(input())
a = list(map(int, input().split()))
b = sorted(a, reverse=True)
sume = 0
sumt = 0
i = 1
y = 0
while sume <= sumt:
	sume = sum(b[0:i])
	sumt = sum(b[i:])
	i = i + 1
	y = y + 1
print(y)


n = int(input())
list = [int(i) for i in input().split()]
x = sum(list)
list1 = sorted(list)
c = n - 1
d = int(x // 2)
e = 0
f = 0
while e <= d:
	e = e + list1[c]
	f = f + 1
	c = c - 1
print(f)


n = int(input())
l = list(map(int, input().split()))
l.sort()
l.reverse()
(B1, B2) = (0, sum(l))
c = 0
for i in l:
	if B1 <= B2:
		B1 += i
		B2 -= i
		c += 1
else:
	print(c)


a = int(input())
to = []
t = 0
m = 0
s = 0
to = list(map(int, input().split()))
for i in to:
	t += i
while m <= t / 2:
	m += max(to)
	ii = to.index(max(to))
	to.remove(to[ii])
	s += 1
print(s)


input()
items = sorted((int(x) for x in input().split()))
(s1, s2, cnt) = (sum(items), 0, 0)
while s1 >= s2:
	cnt += 1
	i = items.pop(len(items) - 1)
	s1 -= i
	s2 += i
print(cnt)


def main():
	n = int(sys.stdin.readline())
	coins = [int(x) for x in sys.stdin.readline().split()]
	coins.sort(reverse=True)
	total = sum(coins)
	cur = 0
	count = 0
	for coin in coins:
		if cur > total:
			break
		cur += coin
		total -= coin
		count += 1
	sys.stdout.write(str(count))
import sys
main()


def input_int():
	return int(input())

def input_str():
	return str(input())

def get_result(a, arr):
	sumOfCoins = sum(arr)
	arr.sort(reverse=True)
	result = 0
	currSum = 0
	for x in arr:
		currSum = currSum + x
		sumOfCoins = sumOfCoins - x
		result = result + 1
		if currSum > sumOfCoins:
			return result
	return result
a = input_int()
arr = [int(x) for x in input().split()]
print(get_result(a, arr))


n = int(input())
a = list(map(int, input().split()))
s = 0
for i in a:
	s += i
s = s / 2
a = sorted(a)
ss = 0
dem = 0
for i in a:
	if ss + i < s:
		ss += i
		dem += 1
print(n - dem)


n = int(input())
s = input()
s = s.split()
w = 0
for i in range(n):
	w = w + int(s[i - 1])
ss = list(set(s))
n = len(ss)
for x in range(n - 1):
	for y in range(n - 1 - x):
		if int(ss[y]) < int(ss[y + 1]):
			(ss[y], ss[y + 1]) = (ss[y + 1], ss[y])
q = 0
e = 0
r = 0
while True:
	A = ss[q]
	a = s.count(A)
	if int(A) * a + e <= w / 2:
		e = e + int(A) * a
		q = q + 1
		r = r + a
	else:
		e = e - w / 2 - 0.5
		print(int(r - e // int(A)))
		break


n = int(input())
l = [int(i) for i in input().split()]
l.sort(reverse=True)
n = sum(l) // 2
c = 0
s = 0
for i in l:
	if s <= n:
		c += 1
		s += i
	else:
		break
print(c)


n = int(input())
a = sorted([int(x) for x in input().split()], reverse=True)
total = sum(a)
result = 0
count = 0
for e in a:
	result += e
	count += 1
	if total < 2 * result:
		break
print(count)


n = int(input())
lt = list(input().split())
s = 0
for i in range(n):
	lt[i] = int(lt[i])
	s += lt[i]
lt.sort(reverse=True)
s //= 2
q = 0
ct = 0
for i in lt:
	if q <= s:
		ct += 1
		q += i
print(ct)


coinsLength = int(input())
coins = input().split()
coins = [int(x) for x in coins]
copy = coins[:]
greatest = []
for (x, i) in enumerate(coins):
	greatest.append(int(max(copy)))
	copy.remove(int(max(copy)))
	if sum(greatest) > sum(copy):
		print(x + 1)
		break


cases = int(input())
coins = input().split(' ')
coins = list(map(int, coins))
coins.sort()
coins.reverse()
total = sum(coins)
my_part = 0
ans = 0
for i in range(0, cases):
	if my_part <= total / 2:
		my_part += coins[i]
		ans += 1
	else:
		break
print(ans)


input()
l = list(map(int, input().split()))
l.sort()
c = v = 0
while v <= sum(l) / 2:
	v += l[-(c + 1)]
	c += 1
print(c)


n = int(input())
rating = []
money = 0
for coin in map(int, input().split()):
	rating.append(coin)
	money += coin
rating.sort(reverse=True)
cur_sum = 0
coin = 0
i = 0
while i < len(rating) and cur_sum <= money // 2:
	cur_sum += rating[i]
	i += 1
	coin += 1
print(coin)


number = int(input())
string = input().split()
coins = []
for i in range(len(string)):
	coins.append(int(string[i]))
coins.sort(reverse=True)
total = sum(coins)
for i in range(len(coins)):
	left = sum(coins[i:])
	me = total - left
	if me > left:
		print(i)
		exit()
print(number)


n = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
sm = []
for i in range(n):
	if sum(sm) <= sum(arr) - sum(sm):
		sm.append(arr[i])
print(len(sm))


numberofcoins = input()
coin_list = input()
coin_list = coin_list.split()
for i in range(len(coin_list)):
	coin_list[i] = int(coin_list[i])
count = 0
sum = sum(coin_list) / 2
another_sum = 0
coin_list.sort(reverse=True)
for item in coin_list:
	another_sum += item
	count += 1
	if another_sum > sum:
		break
print(count)


input()
li = list(map(int, input().split()))
su = sum(li)
li = list(reversed(sorted(li)))
s = 0
n = 0
while s <= su / 2:
	s += li[n]
	n += 1
print(n)


n = int(input())
coins = list(map(int, input().split()))
coins = sorted(coins)
total = 0
amount = 0
for i in range(len(coins)):
	total += coins[-(i + 1)]
	amount += 1
	if total > int(sum(coins) / 2):
		print(amount)
		break


n = int(input())
a = list(map(int, input().split()))
a.sort()
s = sum(a) / 2
x = max(a)
c = 1
if x > s:
	print(c)
elif x <= s:
	for i in a:
		a.pop()
		x += a[-1]
		c += 1
		if x > s:
			print(c)
			break


input()
x = list(map(int, input().split()))
x.sort()
y = []
if len(x) == 2:
	if x[0] == x[1]:
		print(2)
	else:
		print(1)
elif len(x) == 1:
	print(1)
else:
	i = len(x) - 1
	while i >= 0:
		if sum(y) > sum(x[:i + 1]):
			print(len(y))
			break
		else:
			y.append(x[i])
		i = i - 1


num = int(input())
coins = sorted(list(map(int, input().split())), reverse=True)
big = coins[0]
counter = 1
while True:
	total = sum(coins[counter:])
	if big > total:
		print(counter)
		break
	else:
		big += coins[counter]
	counter += 1


from functools import reduce
n = int(input())
m = list(map(int, input().split()))
sum = reduce(lambda a, b: a + b, m)
m.sort(reverse=True)
s = 0
for i in range(len(m)):
	s += m[i]
	if s > sum // 2:
		print(i + 1)
		break


n = int(input().strip())
arr = [int(__) for __ in input().strip().split()]
arr.sort(reverse=True)
half = sum(arr) / 2
ans = 0
su = 0
for x in arr:
	ans += 1
	if su + x > half:
		break
	su += x
print(ans)


n = int(input())
coins = [int(x) for x in input().split(' ')]
a = sorted(coins, reverse=True)
tot = sum(a)
mine = 0
for i in range(n):
	mine += a[i]
	tot -= a[i]
	if mine > tot:
		print(i + 1)
		exit(0)
print(n)


from sys import stdin, stdout
n = int(stdin.readline().strip())
lst = list(map(int, stdin.readline().strip().split()))
lst.sort()
my_num = 1
while True:
	my_sum = 0
	left_sum = 0
	for i in range(my_num):
		my_sum += lst[n - 1 - i]
	for j in range(n - my_num):
		left_sum += lst[j]
	if my_sum > left_sum:
		stdout.write(str(my_num))
		break
	my_num += 1


n = int(input())
li = list(map(int, input().split()))
if n == 1:
	print(1)
else:
	we = 0
	steal = 0
	my = 0
	for num in li:
		we += num
	while my <= we:
		my += max(li)
		li.remove(max(li))
		we = 0
		for num in li:
			we += num
		steal += 1
	print(steal)


n_coins = int(input())
coin_vals = []
coin_vals = list(input().strip().split())
coin_vals = [int(val) for val in coin_vals]
removed_coins = []
minimum_coins = 0
sum_of_the_remaining_coins = sum(coin_vals)
sum_of_the_removed_coins = sum(removed_coins)
while sum_of_the_remaining_coins >= sum_of_the_removed_coins:
	highest_value = max(coin_vals)
	coin_vals.remove(highest_value)
	removed_coins.append(highest_value)
	minimum_coins += 1
	sum_of_the_remaining_coins = sum(coin_vals)
	sum_of_the_removed_coins = sum(removed_coins)
print(minimum_coins)


n = int(input())
lis = list(map(int, input().split()))
lis.sort(reverse=True)
mincoins = 0
sumcoins = sum(lis)
sumneed = 0
for i in range(len(lis)):
	sumneed += lis[i]
	sumcoins -= lis[i]
	mincoins += 1
	if sumneed > sumcoins:
		print(mincoins)
		break


import sys
input = sys.stdin.readline
n = int(input())
l = list(map(int, input().split()))
sum_org = sum(l)
our = 0
l.sort(reverse=True)
i = 0
t = 0
while our <= sum_org:
	our += l[i]
	sum_org -= l[i]
	t += 1
	i += 1
print(t)


n = int(input())
list1 = list(map(int, input().split()))
list1.sort(reverse=True)
c = 0
k = 0
for i in range(n - 1):
	if list1[0] > sum(list1[1:]):
		print(c + 1)
		k = 1
		break
	else:
		b = [sum(list1[0:2])]
		list1 = b + list1[2:]
		c = c + 1
if k != 1:
	print(n)


n = int(input())
list = [int(i) for i in input().split()]
Sum = sum(list)
(Sum2, count) = (0, 0)
list.sort()
list.reverse()
for i in range(n):
	Sum2 += list[i]
	count += 1
	if Sum2 > Sum // 2:
		print(count)
		exit()


n = int(input())
l = list(map(int, input().split()))
l.sort()
req = sum(l) / 2
ans = 0
cursum = 0
for i in range(n - 1, -1, -1):
	cursum += l[i]
	ans += 1
	if cursum > req:
		print(ans)
		break


n = input()
n = int(n)
a = map(int, input().split())
a = list(a)
a.sort()
i = 0
totalFromEnd = sum(a[n - i:n])
totalFromBeginning = sum(a[0:n - i])
while totalFromEnd <= totalFromBeginning:
	i = i + 1
	totalFromEnd = sum(a[n - i:n])
	totalFromBeginning = sum(a[0:n - i])
print(i)


first = int(input())
test = [int(x) for x in input().split()]
test.sort(reverse=True)
for i in range(1, first + 1):
	if sum(test[:i]) > sum(test[i:]):
		print(len(test[:i]))
		break


n = int(input())
coins = input().split(' ')
total_value = 0
for coin in coins:
	total_value += int(coin)
coins.sort(key=int, reverse=True)
my_coins_sum = 0
my_coins_amount = 0
for coin in coins:
	if my_coins_sum > int(total_value / 2):
		pass
	else:
		my_coins_sum += int(coin)
		my_coins_amount += 1
print(my_coins_amount)


def sum(x):
	j = 0
	for i in x:
		j += i
	return j
x = int(input())
lis = list(map(int, input().split()))
cis = sorted(lis, reverse=True)
if x > 3:
	for i in range(len(cis) - 1):
		if sum(cis[:i]) > sum(cis[i:]):
			print(i)
			break
elif x == 3:
	if cis[0] > cis[1] + cis[2]:
		print('1')
	elif cis[0] + cis[1] > cis[2]:
		print('2')
	else:
		print('3')
elif x == 1:
	print('1')
elif x == 2:
	if cis[0] > cis[1]:
		print('1')
	else:
		print('2')


import sys
c = int(input())
x = list(map(int, input().split()))
x.sort()
k = 0
for i in range(c):
	k = k + x[i]
k = k // 2
d = 0
flag = 0
for i in range(-1, -c - 1, -1):
	d = d + x[i]
	flag = flag + 1
	if d > k:
		print(flag)
		sys.exit(0)


import sys
inp = sys.stdin
n = int(inp.readline())
s = inp.readline().split()
a = []
for i in s:
	a.append(int(i))
a.sort()
a.reverse()
Sum = 0
for i in a:
	Sum += i
Half = 0
cnt = 0
for i in a:
	Half += i
	cnt += 1
	if Half * 2 > Sum:
		break
print(cnt)


def ans(a):
	sum = 0
	if len(a) == 1:
		return 1
	for j in range(len(a) - 1):
		for i in range(len(a) - 1 - j):
			if a[i] > a[i + 1]:
				(a[i], a[i + 1]) = (a[i + 1], a[i])
		sum = sum + a[len(a) - 1 - j]
	sum = sum + a[0]
	cnt = 0
	money = 0
	j = len(a) - 1
	while j >= 0:
		if money > sum:
			break
		else:
			money = money + a[j]
			sum = sum - a[j]
			cnt = cnt + 1
			j = j - 1
	return cnt
n = input('')
arr = list(map(int, input().split(' ')))
print(ans(arr))


import heapq as hq
from heapq import heappop, heappush
from collections import deque, defaultdict, Counter
from sys import stdin, stdout

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

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

def insr():
	return list(stdin.readline().strip())

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

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

def subset_sum_count(arr, n, sum):
	dp = [[0 for _ in range(sum + 1)] for _ in range(n + 1)]
	for i in range(n + 1):
		for j in range(sum + 1):
			if j == 0:
				dp[i][j] = 1
			elif arr[i - 1] <= j:
				dp[i][j] = dp[i - 1][j - arr[i - 1]] + dp[i - 1][j]
			else:
				dp[i][j] = dp[i - 1][j]
	return dp[n][sum]

def prefix(a):
	pre = []
	pre.append(a[0])
	for i in range(1, len(a)):
		pre.append(pre[i - 1] + a[i])
	return pre

def binary_search(func, lo, hi, abs_prec=1e-07):
	while abs(hi - lo) > abs_prec:
		mi = lo + (hi - lo) / 2
		if func(mi):
			hi = mi
		else:
			lo = mi
	return (lo + hi) / 2

def ternary_search(func, lo, hi, abs_prec=1e-07):
	while abs(hi - lo) > abs_prec:
		lo_third = lo + (hi - lo) / 3
		hi_third = hi - (hi - lo) / 3
		if func(lo_third) < func(hi_third):
			lo = lo_third
		else:
			hi = hi_third
	return (lo + hi) / 2

def discrete_binary_search(func, lo, hi):
	while lo < hi:
		mi = lo + (hi - lo) // 2
		if func(mi):
			hi = mi
		else:
			lo = mi + 1
	return lo

def discrete_ternary_search(func, lo, hi):
	while lo <= hi:
		lo_third = lo + (hi - lo) // 3
		hi_third = lo + (hi - lo) // 3 + (1 if 0 < hi - lo < 3 else (hi - lo) // 3)
		if func(lo_third) < func(hi_third):
			lo = lo_third + 1
		else:
			hi = hi_third - 1
	return lo
	return -1

def right_rotate(a, s):
	return a[s:] + a[:s]

def dec_to_bin(x):
	return int(bin(x)[2:])

def str_to_integer_list(n):
	a = []
	for i in range(len(n)):
		a.append(int(n[i]))
	return a

def list_to_str(l):
	s = ''
	for i in l:
		s += str(i)
	return s

def dijkstra(s, N, E):
	visited = set()
	dist = {}
	for i in range(1, N + 1):
		dist[i] = 1 << 29
	queue = [(dist[i], i) for i in range(1, N + 1)]
	hq.heappush(queue, (0, s))
	dist[s] = 0
	while queue:
		(d, u) = hq.heappop(queue)
		if u in visited:
			continue
		for t in E[u]:
			(v, r) = t
			if dist[v] > d + r:
				dist[v] = d + r
				hq.heappush(queue, (dist[v], v))
		visited.add(u)
	return dist

def prime_sieve(n):
	flag = n % 6 == 2
	sieve = bytearray((n // 3 + flag >> 3) + 1)
	for i in range(1, int(n ** 0.5) // 3 + 1):
		if not sieve[i >> 3] >> (i & 7) & 1:
			k = 3 * i + 1 | 1
			for j in range(k * k // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
			for j in range(k * (k - 2 * (i & 1) + 4) // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
	return sieve

def prime_list(n):
	res = []
	if n > 1:
		res.append(2)
	if n > 2:
		res.append(3)
	if n > 4:
		sieve = prime_sieve(n + 1)
		res.extend((3 * i + 1 | 1 for i in range(1, (n + 1) // 3 + (n % 6 == 1)) if not sieve[i >> 3] >> (i & 7) & 1))
	return res

def dijkstra(n, graph, start):
	(dist, parents) = ([float('inf')] * n, [-1] * n)
	dist[start] = 0
	queue = [(0, start)]
	while queue:
		(path_len, v) = heappop(queue)
		if path_len == dist[v]:
			for (w, edge_len) in graph[v]:
				if edge_len + path_len < dist[w]:
					(dist[w], parents[w]) = (edge_len + path_len, v)
					heappush(queue, (edge_len + path_len, w))
	return (dist, parents)

def path(start, end, parent):
	path = [end]
	while path[-1] != start:
		path.append(parent[path[-1]])
	path.reverse()
	return path

def bfs(graph, start, end):
	parent = {}
	queue = []
	queue.append(start)
	while queue:
		node = queue.pop(0)
		if node == end:
			return path(start, end, parent)
		for next in graph.get(node, []):
			if node not in queue:
				parent[next] = node
				queue.append(next)

def most_frequent(List):
	return max(set(List), key=List.count)

def subarray(arr, n):
	(ans, temp) = (1, 1)
	for i in range(1, n):
		if arr[i] == arr[i - 1]:
			temp = temp + 1
		else:
			ans = max(ans, temp)
			temp = 1
	ans = max(ans, temp)
	return ans
n = inp()
a = inlt()
a.sort(reverse=True)
s = sum(a) // 2
x = 0
c = 0
i = 0
while x <= s:
	x += a[i]
	c += 1
	i += 1
print(c)


def solution(coinList):
	l = [int(coin) for coin in coinList.split(' ')]
	l.sort(reverse=True)
	total = sum(l) / 2
	tally = (0, 0)
	for coin in l:
		if tally[0] > total:
			return tally[1]
		tally = (tally[0] + coin, tally[1] + 1)
	return tally[1]
input()
print(solution(input()))


n = int(input())
values = list(reversed(sorted([int(x) for x in input().split()])))
total = sum(values)
coins = 1
for i in range(0, n):
	temp = 0
	for j in range(0, coins):
		temp += values[j]
	if temp > total - temp:
		break
	else:
		coins += 1
print(coins)


trash = input()
coins = [int(x) for x in input().split()]
coins.sort()
wallet = 0
res = 0
for i in reversed(coins):
	wallet += coins.pop()
	res += 1
	if wallet > sum(coins):
		print(res)
		break


n = int(input())
s = []
s = input().split()
f = []
for i in s:
	f.append(int(i))
f.sort()
a = 0
for i in f:
	a = a + i
	i = i - 1
i = n - 1
b = 0
while i >= 0:
	b = b + f[i]
	a = a - f[i]
	if b > a:
		break
	else:
		i = i - 1
print(n - i)


n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)

def coins(a):
	c = 0
	for i in range(len(a)):
		t1 = a[:i + 1]
		t2 = a[i + 1:]
		if t1 and t2:
			if sum(t1) > sum(t2):
				return c + 1
			else:
				c += 1
		else:
			c += 1
	return c
print(coins(a))


def coinsset(coins):
	total = 0
	part1 = 0
	count = 0
	for i in coins:
		total = total + i
	for i in coins:
		count += 1
		part1 = part1 + i
		if part1 > total - part1:
			return count
n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
print(coinsset(coins))


input()
val = sorted(map(int, input().split()))
c = mysum = 0
while sum(val) >= mysum:
	mysum += val.pop()
	c += 1
print(c)


n = int(input())
s = [int(k) for k in input().split()]
nCount = 0
for i in range(n):
	nCount += 1
	s.sort()
	s.reverse()
	left = sum(s[0:nCount])
	subete = sum(s[0:])
	right = subete - left
	if left > right:
		break
print(nCount)


total = int(input())
value = input()
coin = []
t = 0
while t < total:
	coin.append(int(value.split()[t]))
	t = t + 1
coin.sort()
totalvalue = 0
for i in coin:
	totalvalue = totalvalue + i
twin = 0
num = 0
for j in coin:
	if twin < totalvalue / 2:
		twin = twin + j
		num = num + 1
	else:
		break
me = len(coin) - num + 1
print(me)


n = int(input())
coins = [int(i) for i in input().split()]
coins.sort(reverse=True)
totalSum = 0
minCoins = 0
coinSum = 0
for i in coins:
	totalSum += i
for i in coins:
	coinSum += i
	minCoins += 1
	if coinSum > totalSum - coinSum:
		print(minCoins)
		break


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
out = 1
while sum(coins[:out]) <= sum(coins[out:]):
	out += 1
print(out)


input()
coins = sorted(map(int, input().split()), reverse=True)
cnt = left_sum = 0
right_sum = sum(coins)
for coin in coins:
	left_sum += coin
	right_sum -= coin
	cnt += 1
	if left_sum > right_sum:
		break
print(cnt)


def main():
	n = int(input())
	coins = [int(x) for x in input().split()]
	coins.sort()
	tot_amt = sum(coins) / 2
	ans = 0
	tak_amt = 0
	while tak_amt <= tot_amt:
		tak_amt += coins[-1]
		ans += 1
		coins = coins[:-1]
	print(ans)
main()


n = int(input())
coins = sorted(map(int, input().split(' ')))
sums = 0
sums += coins.pop()
while sums <= sum(coins):
	sums += coins.pop()
print(n - len(coins))


b = int(input())
list = input().split()
for a in range(b):
	list[a] = int(list[a])
list.sort(reverse=True)
f = 0
e = sum(list)
for i in range(b):
	f += list[i]
	if 2 * f > e:
		print(i + 1)
		break


a = int(input())
s = input().split()
lst = []
lst2 = [0]
for el in s:
	lst.append(int(el))
while sum(lst) >= sum(lst2):
	i = lst.index(max(lst))
	lst2.append(lst.pop(i))
print(a - len(lst))


input()
l = list(map(int, input().split(' ')))
l.sort(reverse=True)
for i in range(len(l) - 1):
	if sum(l[:i + 1]) > sum(l[i + 1:]):
		print(i + 1)
		break
else:
	print(len(l))


n = input()
coins = list(map(int, input().split()))
sum_of_coins = sum(coins)
sum1 = 0
count = 0
while sum1 <= sum_of_coins / 2:
	sum1 += max(coins)
	coins.remove(max(coins))
	count += 1
print(count)


n = int(input())
ans = 0
cnt = 0
a = [int(x) for x in input().split()]
new_a = sorted(a)
mid = int(sum(a) / 2)
while ans <= mid:
	cnt += 1
	ans += new_a[n - cnt]
print(cnt)


n = int(input())
monet = [int(i) for i in input().split()]
s = sum(monet) / 2
s1 = 0
for i in range(n):
	el = max(monet)
	s1 += el
	monet.remove(el)
	if s1 > s:
		break
print(i + 1)


s = int(input())
sum = sum1 = 0
t = input().split(' ')
for i in range(0, s):
	t[i] = int(t[i])
	sum += t[i]
t.sort()
for j in range(0, s + 1):
	if sum1 > sum:
		print(j)
		break
	else:
		sum1 += t[s - j - 1]
		sum -= t[s - j - 1]


x = int(input())
y = list(map(int, input().split(' ')))
k = sorted(y, reverse=True)
z = []
for i in range(len(y)):
	z.append(k[i])
	if sum(z) > sum(k[i + 1:]):
		break
print(len(z))


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
count = 0
temp = 0
coin_t = []
for i in range(n):
	temp = temp + coins[i]
	coin_t.append(coins[i])
	count = count + 1
	if sum(coin_t) > sum(coins) - sum(coin_t):
		break
print(count)


kol_monet = int(input())
moneta = list(sorted(map(int, input().split()), reverse=True))
i = 0
summa = 0
count = 0
while summa <= sum(moneta):
	summa += moneta[i]
	moneta.remove(moneta[i])
	count += 1
print(count)


nStr = input()
n = int(nStr)
coinList = input()
coinStr = coinList.split()
coins = [0] * n
for i in range(n):
	coins[i] = int(coinStr[i])
coins.sort()
total = sum(coins)
valueLim = total // 2 + 1
curValue = 0
coinCnt = 0
while curValue < valueLim:
	curValue = curValue + coins.pop()
	coinCnt = coinCnt + 1
print(coinCnt)


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


n = int(input())
b = list(map(int, input().split()))
s = c = 0
a = sum(b) / 2
while c < n:
	if s > a:
		break
	else:
		s = s + max(b)
		b.remove(max(b))
		c += 1
print(c)


from bisect import bisect_right as br
import sys
from collections import *
from math import *
import re

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
	c = 0
	for i in range(2, n):
		if prime[i]:
			c += 1
	return c

def totient(n):
	(res, p) = (n, 2)
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			res -= int(res / p)
		p += 1
	if n > 1:
		res -= int(res / n)
	return res

def iseven(n):
	return [False, True][0 if n % 2 else 1]

def inp_matrix(n):
	return list(([input().split()] for i in range(n)))

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

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

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

def lcm(a, b):
	return a * b / gcd(a, b)
max_int = sys.maxsize
mod = 10 ** 9 + 7
flag = False
n = int(input())
arr = sorted(inp_arr(), reverse=True)
ans = s = 0
for i in range(n):
	s += arr[i]
	if s > sum(arr[i + 1:]):
		ans += 1
		break
	else:
		ans += 1
print(ans)


n = int(input())
coins = [int(i) for i in input().split()]
coins.sort(reverse=True)
summation = sum(coins)
target = summation / 2
stolen = 0
counter = 0
for coin in coins:
	stolen += coin
	counter += 1
	if stolen > target:
		break
print(counter)


n = int(input())
data1 = input()
data1 = data1.split()
data = []
sum = 0
for i in data1:
	data.append(int(i))
	sum += int(i)
data.sort(reverse=True)
half = sum / 2
our = 0
answ = 0
for i in data:
	answ += 1
	our += i
	if our > half:
		break
print(answ)


n = int(input())
l = []
l = list(map(int, input().split()))
mt = 0
c = 0
while 1:
	m = max(l)
	mt += m
	l.remove(m)
	s = sum(l)
	c += 1
	if mt > s:
		break
print(c)


input()
coins = [int(i) for i in input().split()]
coins.sort()
taken = 0
number = 0
while True:
	taken += coins.pop()
	number += 1
	if taken > sum(coins):
		break
print(number)


n = int(input())
b = 1
a = [int(x) for x in input().split()]
a.sort(reverse=True)
while sum(a[:b]) <= sum(a[b:]):
	b += 1
print(b)


n = int(input())
arr = sorted([int(i) for i in input().split()], reverse=True)
ind = 0
changeInd = True
for i in range(len(arr) + 1):
	if changeInd and sum(arr[:i]) > sum(arr[i:]):
		ind = i
		changeInd = False
print(ind)


import math
n = int(input())
lis = list(map(int, input().split()))
needed = set(lis)
anall = 0
if sum(lis) / 2 % 1 != 0:
	need = math.ceil(sum(lis) / 2)
else:
	need = int(sum(lis) / 2) + 1

def func_1():
	global need
	global anall
	c = max(needed)
	needed.remove(max(needed))
	x = lis.count(c)
	countc = x * c
	if countc > need:
		x = math.ceil(need / c)
		anall = (x - 1) * c
		return x
	elif countc == need:
		return int(need / c)
	else:
		anall = countc
		need = need - anall
		func1 = func_1()
		return x + func1
print(func_1())


input()
l = sorted(map(int, input().split()))
s = count = 0
while s <= sum(l):
	s += l.pop()
	count += 1
print(count)


n = int(input())
l = list(map(int, input().split()))
s = sum(l)
l1 = sorted(l)
l1 = l1[::-1]
c = 0
s1 = 0
for i in l1:
	if s1 > s // 2:
		break
		s1 += i
	else:
		c += 1
		s1 += i
print(c)


n = int(input())
a = [int(a) for a in input().split()]
a.sort()
s = sum(a)
c = m = 0
for i in range(-1, -n - 1, -1):
	if m <= s:
		m = m + a[i]
		s = s - a[i]
		c = c + 1
print(c)


w = int(input())
inputArr = input().split()
arr = [int(x) for x in inputArr]
arr.sort()
totalNum = sum(arr) / 2
i = len(arr) - 1
coinNum = 0
while totalNum > -0.1:
	totalNum -= arr[i]
	i -= 1
	coinNum += 1
print(coinNum)


n = int(input())
num = [-int(x) for x in input().split()]
L = sorted(num)
segma = 0
for x in range(len(L)):
	segma = segma + L[x]
	if 2 * abs(segma) > abs(sum(L)):
		print(x + 1)
		break


n = int(input())
e = input()
a = [int(x) for x in e.split()]
a.sort(reverse=True)
i = 1
suml = a[0]
while suml <= sum(a[i:]):
	suml += a[i]
	i += 1
print(i)


a = int(input())
b = sorted(list(map(int, input().split()[:a])), reverse=True)
bsum = sum(b) / 2
blen = len(b) // 2 + 1
c = 1
d = 0
for i in range(len(b) - 1):
	d += b[i]
	if d <= bsum:
		c += 1
	else:
		break
print(c)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
d = sum(a)
d = int(d / 2) + 1
sumi = 0
i = 0
for j in a:
	sumi = sumi + j
	i = i + 1
	if sumi >= d:
		break
print(i)


num = int(input())
coins = list(map(int, input().split()))
if num == 1:
	print(1)
elif num == 2 and coins[0] == coins[1]:
	print(2)
else:
	count = 0
	x = 0
	y = sum(coins)
	coins = sorted(coins, reverse=True)
	while x <= y:
		x += coins[count]
		y -= coins[count]
		count += 1
	print(count)


_ = input()
coins = sorted(map(int, input().split()), reverse=True)
total = sum(coins)
my_sum = 0
taken = 0
for coin in coins:
	my_sum += coin
	taken += 1
	if my_sum > total / 2:
		break
print(taken)


x = input()
array = list(map(int, input().split()))
array.sort()
array.reverse()
sum = 0
count = 0
sum1 = 0
for i in array:
	sum += i
for i in array:
	if sum / 2 < sum1:
		break
	count += 1
	sum1 += i
print(count)


a = int(input())
b = list(map(int, input().split()))
cont = 0
for i in b:
	cont += i
cont2 = 0
b.sort()
b = b[::-1]
for i in range(a):
	cont2 += b[i]
	if cont2 > cont / 2:
		break
print(i + 1)


m = int(input())
s = [int(i) for i in input().split()]
k1 = 0
for i in s:
	k1 += i
s.sort(reverse=True)
k = 0
while k <= k1 // 2:
	k += s[0]
	del s[0]
print(m - len(s))


n = int(input())
a = input().split()
for i in range(0, len(a)):
	a[i] = int(a[i])
a.sort()
a.reverse()
polsum = sum(a) / 2
sym = 0
kol = 0
for i in range(0, len(a)):
	sym += a[i]
	kol += 1
	if sym > polsum:
		break
print(kol)


n = int(input())
their_coins = [int(x) for x in input().split()]
their_coins.sort()
my_coins = []
while sum(my_coins) <= sum(their_coins):
	my_coins.append(their_coins.pop())
print(len(my_coins))


num_vals = input()
coin_vals = input().split()
int_coin_vals = []
for coin in coin_vals:
	int(coin)
	int_coin_vals.append(int(coin))
sum_coins = sum(int_coin_vals)
int_coin_vals.sort(reverse=True)
total = 0
n = 0
for coin in int_coin_vals:
	if total > sum_coins / 2:
		break
	else:
		total = total + coin
		n = n + 1
print(n)


n = input()
l = map(int, input().split())
l = sorted(l, reverse=True)
s = sum(l)
h = s / 2
sr = 0
for (index, ele) in enumerate(l):
	sr += ele
	if sr > h:
		break
print(index + 1)


n = int(input())
str = input()
lst = []
lst1 = str.split(' ')
sum1 = 0
a = 0
sum = 0
for i in range(0, n):
	a = int(lst1[i])
	lst.append(a)
	sum1 += a
lst.sort()
lst.reverse()
for i in range(0, n):
	sum += lst[i]
	if 2 * sum > sum1:
		break
print(i + 1)


n = int(input())
moedas = [*map(int, input().split())]
metade = sum(moedas) / 2
moedas = sorted(moedas)
cont = 0
soma = 0
index = 0
for e in moedas[::-1]:
	soma += e
	cont += 1
	if soma > metade:
		break
print(cont)


n = int(input())
l = [int(i) for i in input().split()]
l.sort(reverse=True)
z = 0
for i in range(n):
	z += l[i]
s = 0
for i in range(n):
	s += l[i]
	if s > z - s:
		print(i + 1)
		break


n = int(input())
a = list(map(int, input().split()))
b = list(sorted(a))
b = list(reversed(b))
half = sum(a) / 2
count = 0
i = 0
while count <= half:
	count += b[i]
	i += 1
print(i)


itemsum = 0
rsum = 0
count = 0
n = int(input())
l = input().split(' ')
l = list(map(int, l))
l.sort()
for item in l:
	itemsum += item
l = l[::-1]
for ritem in l:
	count += 1
	rsum += ritem
	if rsum > itemsum - rsum:
		break
print(count)


n = int(input())
arr = list(map(int, input().split()))
mine = []
while sum(mine) <= sum(arr):
	mx = max(arr)
	mine.append(mx)
	arr.pop(arr.index(mx))
print(len(mine))


_ = int(input())
lst = list(map(int, input().split()))
lst.sort(reverse=True)
tot = sum(lst)
mine = 0
ans = 0
while 2 * mine <= tot:
	mine += lst[ans]
	ans += 1
print(ans)


length = int(input())
numbers = [int(i) for i in input().split()]
numbers.sort()
numbers = numbers[::-1]
total = sum(numbers)
value = 0
count = 0
for item in numbers:
	value += item
	count += 1
	if total - value < value:
		print(count)
		break


def read_ints():
	temp = input()
	ints = [int(t) for t in temp.split(' ')]
	return ints
coins = input()
coins = read_ints()
total = sum(coins)
coins.sort(reverse=True)
mine = 0
sum_mine = 0
for coin in coins:
	if sum_mine > total:
		break
	else:
		mine += 1
		sum_mine += coin
		total -= coin
print(mine)


n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
coins = 0
i = n
me = 0
if n == 1:
	print(1)
else:
	while True:
		if me > sum(l[:i]):
			break
		else:
			me += l[i - 1]
			coins += 1
			i -= 1
	print(coins)


n = int(input())
l = input().split(' ')
k = list(map(int, l))
k.sort()
sum = sum(k)
sum1 = 0
count = 0
for i in reversed(k):
	if sum >= sum1:
		sum = sum - i
		sum1 = sum1 + i
		count = count + 1
print(count)


def twin(n, a):
	m = []
	c = 0
	while sum(m) <= sum(a):
		m.append(max(a))
		a.remove(max(a))
		c += 1
	return c
n = input()
a = list(map(int, input().split()))
print(twin(n, a))


n = int(input())
m = list(map(int, input().split()))
m = sorted(m, reverse=True)
count = 0
s = 0
i = 0
while True:
	s += m[i]
	if s > sum(m) / 2:
		break
	else:
		count += 1
		i += 1
print(count + 1)


n = int(input())
a = [int(x) for x in input().split()]
m = []
a.sort()

def sumarray(arr):
	sum = 0
	for i in range(len(arr)):
		sum += int(arr[i])
	return sum
while sumarray(a) >= sumarray(m):
	num = a.pop(len(a) - 1)
	m.append(num)
print(len(m))


import sys
from math import *
input = sys.stdin.readline
RI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
rw = lambda : input().strip().split()
from collections import defaultdict as df
import heapq
infinite = float('inf')
n = int(input())
l = RI()
l.sort(reverse=True)
s = sum(l) / 2
temp = 0
c = 0
for i in range(n):
	temp += l[i]
	c += 1
	if temp > s:
		break
print(c)


d = int(input())
a = [int(e) for e in input().split()]
a.sort()
v = len(a)
s = sum(a)
c = 0
while c <= s:
	c += a[-1]
	s -= a[-1]
	a = a[:-1]
print(v - len(a))


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
total = sum(l)
take = 0
coin = 0
for i in reversed(l):
	take += i
	coin += 1
	if take > total / 2:
		break
print(coin)


coins = int(input())
li = list(map(int, input().split(' ')))
li.sort()
li.reverse()
i = 0
summ = 0
while True:
	summ += li[i]
	i += 1
	if summ > int(sum(li) / 2):
		break
print(i)


n = int(input())
list_of_coins = [int(i) for i in input().split()]
list_of_coins.sort(reverse=True)
sum_of_total_coins = sum(list_of_coins)
middle_value = sum_of_total_coins // 2 + 1
x = 0
total = 0
while x < middle_value:
	total += 1
	x += list_of_coins[0]
	list_of_coins.pop(0)
print(total)


number = int(input())
coins = [int(x) for x in input().split()]
sum1 = 0
sum2 = 0
j = 0
coins.sort(reverse=True)
for i in range(len(coins) + 1):
	if sum(coins[:i]) > sum(coins[i:]):
		print(i)
		quit()
print(1)


s = input()
a = input().split()
s = []
for i in a:
	i = int(i)
	s.append(i)
s.sort()
l = len(s)
r = []
for i in range(0, l):
	r.append(s.pop())
	if sum(r) > sum(s):
		print(len(r))
		break


n = int(input())
l = [int(i) for i in input().split()]
l.sort()
go = True
(a, b, c) = (0, 0, 0)
for i in l:
	c += i
while go:
	a += 1
	b += l[-1]
	c -= l[-1]
	l.remove(l[-1])
	if b > c:
		go = False
print(a)


n = int(input())
coins = [int(x) for x in input().split()]
greedSum = 0
numCoins = 0
while greedSum <= sum(coins):
	maximun = max(coins)
	coins.remove(maximun)
	greedSum += maximun
	numCoins += 1
print(numCoins)


n = int(input())
a = map(int, input().split())
a = sorted(a, reverse=True)
total_sum = sum(a)
current_sum = 0
ans = 0
for x in a:
	ans = ans + 1
	current_sum = current_sum + x
	if current_sum + current_sum > total_sum:
		break
print(ans)


n = int(input())
c = list(map(int, input().split()))
c.sort()
twin = sum(c)
count = 0
my = 0
i = -1
while my <= twin:
	my += c[i]
	twin -= c[i]
	count += 1
	i -= 1
print(count)


int(input())
l = list(map(int, input().split()))
a = sorted(l, reverse=True)
b = []
while sum(a) >= sum(b):
	b.append(a[0])
	del a[0]
print(len(b))


coinsNumber = int(input())
values = [int(x) for x in input().split()]
coinsValue = [int(values[i]) for i in range(coinsNumber)]
coinsValue.sort(reverse=True)
totalCoins = sum(coinsValue)
coinSum = 0
subtraction = totalCoins
index = 0

def solve(coinSum, subtraction, index):
	if subtraction >= coinSum:
		solve(coinSum + coinsValue[index], subtraction - coinsValue[index], index + 1)
	else:
		print(index)
solve(coinSum, subtraction, index)


n = int(input())
list = [int(i) for i in input().split()]
list_s = sorted(list, reverse=True)
sum = 0
for i in list:
	sum += i
sum // 2
sum2 = 0
for j in range(len(list_s)):
	sum2 += list_s[j]
	if sum2 > sum // 2:
		print(j + 1)
		break


n = int(input())
a = list(map(int, input().split()))
a = list(sorted(a, reverse=True))
summ = 0
cnt = 0
for i in range(n):
	summ += a[i]
	if summ > sum(a[i + 1:]):
		cnt += 1
		break
	else:
		cnt += 1
print(cnt)


num_coins = int(input())
coins = input()
coins = list(map(int, coins.split()))
sum_coin = sum(coins)
coins = sorted(coins, reverse=True)
my_sum = 0
counter = 0
while my_sum < sum_coin / 2:
	my_sum = my_sum + coins[counter]
	counter += 1
if my_sum == sum_coin / 2:
	counter += 1
print(counter)


n = int(input())
arr = sorted(list(map(int, input().split())), reverse=True)
sum_ = sum(arr)
buffer_ = 0
answ = 0
for i in arr:
	if buffer_ <= sum_ - buffer_:
		answ += 1
		buffer_ += i
print(answ)


n = input()
l = [int(a) for a in input().split()]
l.sort()
s = 0
su = sum((l[i] for i in range(0, len(l))))
i = len(l) - 1
while s <= su / 2:
	s = s + l[i]
	i = i - 1
print(len(l) - i - 1)


n = int(input())
l = list(map(int, input().split()))
l.sort()
s = int(0)
l1 = []
for i in range(len(l)):
	s += l[i]
s1 = int(0)
m = int(0)
for i in range(len(l)):
	s1 += l[n - i - 1]
	m = i + 1
	if s1 > s - s1:
		break
print(m)


n = int(input())
L = [int(j) for j in input().split()]
L.sort()
L.reverse()
count = 0
n = 0
for coin in L:
	count += coin
	n += 1
	if count > sum(L) / 2:
		break
print(n)


n = int(input())
coins = sorted(list(map(int, input().split())))
(sums, count) = (0, 0)
while sums <= sum(coins):
	sums += coins.pop()
	count += 1
print(count)


n = int(input())
s = list(map(int, input().split()))
m1 = sum(s)
m2 = 0
c = 0
s.sort(reverse=True)
for coin in s:
	m1 -= coin
	m2 += coin
	c += 1
	if m2 > m1:
		break
print(c)


count = int(input())
list = [int(x) for x in input().split()]
list.sort(reverse=True)
temp = 0
i = 0
ans = 0
val = 0
while i < count:
	temp += list[i]
	i += 1
j = 0
while j < count:
	val += list[j]
	temp -= list[j]
	ans += 1
	if val > temp:
		break
	j += 1
print(ans)


a = int(input())
l = [int(i) for i in input().split()]
l.sort()
n = len(l)
x = sum(l)
ans = 0
cnt = 0
while x >= ans:
	x -= l[n - 1]
	ans += l[n - 1]
	n -= 1
	cnt += 1
print(cnt)


n = int(input())
l = list(map(int, input().split()))
l = sorted(l, reverse=True)
ans = 0
for i in range(1, n):
	if sum(l[:i]) > sum(l[i:]):
		ans = len(l[:i])
		break
else:
	ans = n
print(ans)


n = int(input())
moedas = list(map(int, input().split(' ')))
minimo = sum(moedas) / 2
moedas.sort(reverse=True)
soma = 0
for i in range(n):
	soma += moedas[i]
	if soma > minimo:
		print(i + 1)
		break


n = input()
line = list(map(int, input().split()))
x = sum(line)
c = 0
a = 0
line.sort()
line.reverse()
for i in line:
	c = c + i
	a = a + 1
	if c > x / 2:
		print(a)
		break


n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
for i in range(n):
	if sum(a[:i]) > sum(a[i:]):
		res = i
		break
try:
	print(res)
except:
	print(n)


n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
x = 0
count = 0
d = sum(a)
for i in a:
	x += i
	count += 1
	if d - x < x:
		break
print(count)


n = int(input())
vals = [int(x) for x in input().split()]
vals.sort(reverse=True)
s = sum(vals)
q = 0
n = 0
for m in vals:
	q += m
	n += 1
	if q > s - q:
		break
print(n)


num = int(input())
moedas = sorted([int(v) for v in input().split(' ')], reverse=True)
minha_soma = 0
irmao_soma = sum(moedas)
num_moedas = 0
while minha_soma <= irmao_soma:
	minha_soma += moedas[num_moedas]
	irmao_soma -= moedas[num_moedas]
	num_moedas += 1
print(num_moedas)


a = int(input())
c = [int(x) for x in input().split()]
c.sort(reverse=True)
count = 0
for i in range(len(c)):
	count = count + c[0]
	c.pop(0)
	if count > sum(c):
		print(i + 1)
		break


n = int(input())
a = [*map(int, input().split())]
a = sorted(a, reverse=True)
yy = sum(a)
i = s = 0
while i < n and s <= yy:
	s += a[i]
	yy -= a[i]
	i += 1
print(i)


m = input()
coins = list(map(int, input().split()))
coins.sort()
l = 0.5 * sum(coins)
(a, n) = (0, 0)
while a <= l:
	a += coins.pop()
	n += 1
print(n)


n = int(input())
coins = list(map(int, input().strip().split(' ')))
c = 0
coins.sort()
p1 = 0
p2 = 0
while p1 <= p2:
	p1 = p1 + max(coins)
	coins.remove(max(coins))
	p2 = sum(coins)
	c = c + 1
print(c)


n = int(input())
m = list(map(int, input().split()))
m.sort()
a = 0
b = 0
while a <= sum(m) - a:
	a += m[-b - 1]
	b += 1
print(b)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = 0
temp = sum(a) // 2
i = 0
c = 0
while i < n and c <= temp:
	c += a[i]
	i += 1
	ans += 1
print(ans)


z = input
z()
a = sorted(list(map(int, z().split())))
b = 0
c = 0
while b <= sum(a):
	b += a.pop()
	c += 1
print(c)


numberOfCoins = int(input())
coinValue = input().split(' ')
totalSum = 0
for i in range(numberOfCoins):
	coinValue[i] = int(coinValue[i])
	totalSum += coinValue[i]
coinValue.sort()
broValue = 0
length = len(coinValue) - 1
i = length
while broValue <= totalSum // 2:
	broValue += coinValue[i]
	i -= 1
print(length - i)


num = int(input())
coins = list(map(int, input().split()))
coins = sorted(coins, reverse=True)
total = sum(coins)
num_take = 0
sum_of_coins = 0
for coin in coins:
	if sum_of_coins > total // 2:
		break
	num_take += 1
	sum_of_coins += coin
print(num_take)


n = input()
l = list(map(int, input().split()))
l.sort(reverse=True)
c = []
for i in range(len(l)):
	if 2 * sum(c) <= sum(l):
		c.append(l[i])
	else:
		break
print(len(c))


n = int(input())
coins = list(map(int, input().split()))
coins.sort()
coins.reverse()
jam_kol = sum(coins)
res = 0
pul = 0
j = 0
for i in coins:
	if pul > jam_kol:
		print(res)
		j = 1
		break
	else:
		pul += i
		jam_kol = jam_kol - i
		res += 1
if j != 1:
	print(res)


input()
m = list(map(int, input().split()))
m.sort()
m.reverse()
sum = 0
for i in m:
	sum += i
i = -1
q = 0
while sum >= q:
	i += 1
	q += m[i]
	sum -= m[i]
print(i + 1)


n = int(input())
coins = sorted(map(int, input().split()), reverse=True)
smart = []
for itx in range(len(coins)):
	if sum(coins[itx:]) >= sum(smart):
		smart.append(coins[itx])
print(len(smart))


n = int(input())
a = list(map(int, input().split()))
s = sum(a) // 2 + 1
a.sort(reverse=True)
ct = 0
p = 0
while p < s:
	p += a.pop(0)
	ct += 1
print(ct)


n = int(input())
arr = list(map(int, input().split()))
s1 = sum(arr)
c = 0
s2 = 0
s = sorted(arr, reverse=True)
for e in s:
	s2 = s2 + e
	s1 = s1 - e
	c = c + 1
	if s2 > s1:
		break
print(c)


def ans(arr, n):
	(sum1, sum2) = (0, 0)
	if n == 1:
		return 1
	elif n == 2 and arr[0] == arr[1]:
		return 2
	else:
		for i in range(1, len(arr)):
			sum1 = sum(arr[0:i])
			sum2 = sum(arr[i:len(arr)])
			if sum1 > sum2:
				return i
n = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
count = ans(arr, n)
print(count)


n = int(input())
coins = map(int, input().split())
coins = sorted(coins)
sum_coins = sum(coins)
current_sum = 0
i = 1
while current_sum <= sum_coins:
	current_sum += coins[-i]
	sum_coins -= coins[-i]
	i += 1
print(i - 1)


n = int(input())
arr = list(map(int, input().rstrip().split()))
a = [0]
arr.sort(reverse=True)
while True:
	if sum(a) <= sum(arr):
		a.append(arr.pop(0))
	else:
		break
print(len(a) - 1)


n = int(input())
cash = [int(x) for x in input().split()]
num = 0
cash.sort(reverse=True)
ad = 0
half = sum(cash) / 2
for i in range(n):
	ad = ad + cash[i]
	num = num + 1
	if ad > half:
		print(num)
		break


n = int(input())
val = []
val = input().split(' ')
val = [int(i) for i in val]
val.sort(reverse=True)
for i in range(n + 1):
	if sum(val[:i]) > sum(val[i:]):
		print(i)
		exit()


l = []
k = 0
sum = 0
x = int(input())
n = list(map(int, input().split()))
l = sorted(n, reverse=True)
for x in n:
	k += x
sum = k / 2
nb = 0
s = 0
r = 0
for j in l:
	r += j
	nb += 1
	if r > sum:
		print(nb)
		break


n = int(input())
coins = list(map(int, input().split()))
sumc = sum(coins)
coins.sort(reverse=True)
nsum = 0
for i in range(n):
	nsum += coins[i]
	if nsum > sumc / 2:
		print(i + 1)
		break


n = int(input())
arr = [int(x) for x in input().split()]
mxr = []
while sum(mxr) <= sum(arr):
	m = max(arr)
	mxr.append(m)
	arr.remove(m)
print(len(mxr))


input()
coins = sorted([int(c) for c in input().split()], reverse=True)
half_sum = sum(coins) / 2
twin_sum = int()
total_coins = int()
for coin in coins:
	total_coins += 1
	twin_sum += coin
	if twin_sum > half_sum:
		break
print(total_coins)


num = int(input())
l = list(map(int, input().split()))
l.sort()
l = l[::-1]
s = 0
su = sum(l) - l[0]
c = 0
if num == 1:
	print(1)
elif num == 2:
	if l[0] == l[1]:
		print(2)
	else:
		print(1)
else:
	while s <= su:
		s += l[c]
		su = sum(l) - s
		c += 1
	print(c)


dust = int(input())
a = [int(x) for x in input().split(' ')]
a.sort()
sum = 0
for i in a:
	sum += i
ans = 0
for i in range(-1, -len(a) - 1, -1):
	sum -= 2 * a[i]
	ans += 1
	if sum < 0:
		break
print(ans)


a = int(input())
b = [int(s) for s in input().split()]
b.sort()
for k in range(1, len(b) + 1):
	if sum(b[a - k:]) > sum(b[:a - k]):
		print(k)
		break


def twin(k: list) -> int:
	count = 0
	for (i, j) in enumerate(k + [0]):
		if sum(k[i:]) < count:
			return i
		else:
			count += j
input()
l = sorted(map(int, input().split(' ')), reverse=True)
print(twin(l))


input()
s = list(map(int, input().split(' ')))
s.sort(reverse=True)
ss = sum(s)
ss1 = 0
i = 0
for e in s:
	ss1 += e
	i += 1
	if ss1 > ss - ss1:
		print(i)
		break


n = int(input())
a = sorted([int(x) for x in input().split()], reverse=True)
b = []

def summa(a):
	result = 0
	for i in a:
		result += i
	return result
while summa(b) <= summa(a):
	b.append(a[0])
	del a[0]
print(len(b))


import math
import os
import sys
import re
import itertools
import functools
import operator
(n, A) = (int(input()), sorted(map(int, input().split()), reverse=True))
(s, x) = (sum(A), 0)
for (i, el) in enumerate(A):
	x = x + el
	s = s - el
	if x > s:
		print(i + 1)
		quit()


n = int(input())
l = [int(j) for j in input().split()]
l.sort()
c = 1
if n == 1:
	print('1')
else:
	while sum(l[0:n - c]) >= sum(l[n - c:]):
		c = c + 1
		if c == n:
			break
	print(c)


n = int(input())
a = list(map(int, input().split()))
a.sort()
k = sum(a) / 2
x = 0
r = -1
while x <= k:
	x += a[r]
	r -= 1
print(abs(r + 1))


n = int(input())
l = list(map(int, input().split()))
l = sorted(l, reverse=True)
for i in range(n):
	l1 = l[:i]
	l2 = l[i:]
	if sum(l1) > sum(l2):
		print(i)
		exit()
else:
	print(n)


num = input()
l = input().split()
l1 = []
for m in l:
	l1.append(int(m))
l1.sort(reverse=True)
total = 0
total2 = 0
for i in l1:
	total += i
for j in range(len(l1)):
	total2 += l1[j]
	if total2 > total / 2:
		break
print(j + 1)


from functools import reduce
t = int(input())
s = list(map(int, input().split()))
s.sort()
s.reverse()
for i in range(len(s)):
	if len(s) == 1:
		print(1)
		break
	if len(s) == 2:
		if s[0] > s[1]:
			print(1)
		else:
			print(2)
		break
	if reduce(lambda x, y: x + y, s[:i + 1]) > reduce(lambda x, y: x + y, s[i + 1:]):
		print(i + 1)
		break


n = int(input())
s = list(map(int, input().split(' ')))
s.sort(reverse=True)
su = sum(s)
toTake = s[0]
result = 1
for i in range(1, n):
	result += 1
	if toTake > su - toTake:
		result -= 1
		break
	toTake += s[i]
print(result)


number_of_coins = input()
coins_values = list(map(int, input().split()))
total = 0
for coin in coins_values:
	total += coin
half = total / 2
coins = 0
quantity = 0
coins_values.sort()
for i in range(len(coins_values) - 1, -1, -1):
	quantity += coins_values[i]
	coins += 1
	if quantity > half:
		break
print(coins)


n = int(input())
lst = list(map(int, input().split()))
ls = sorted(lst)
c = 0
sum1 = 0
i = 0
while sum1 <= sum(ls):
	sum1 = sum1 + ls.pop()
	c = c + 1
print(c)


n = int(input())
coins = [int(i) for i in input().split()]
coins.sort(reverse=True)
(myCoinsSum, myCoinsCount, leftover) = (0, 0, sum(coins))
for i in coins:
	myCoinsSum += i
	myCoinsCount += 1
	leftover -= i
	if myCoinsSum > leftover:
		break
print(myCoinsCount)


from collections import Counter
ncoins = input()
coins = [int(i) for i in input().split(' ')]
total = sum(coins)
coins = Counter(coins)
mysum = 0
mycoins = 0
for k in reversed(sorted(coins.keys())):
	if mysum + k * coins[k] <= total / 2:
		mycoins += coins[k]
		mysum += k * coins[k]
	else:
		while mysum <= total / 2:
			mysum += k
			mycoins += 1
		break
print(mycoins)


n = int(input())
l = list(map(int, input().split()))
nl = [0] * 100
gs = 0
for e in l:
	nl[e - 1] += 1
	gs += e
s = 0
m = 0
for i in range(100, 0, -1):
	for j in range(nl[i - 1]):
		if s > gs - s:
			break
		s += i
		m += 1
	if s > gs - s:
		break
print(m)


input()
coin = list(map(int, input().split()))
fq = 101 * [0]
S = 0
Me = 0
num = 0
for i in coin:
	fq[i] += 1
	S += i
for i in range(-100, 0):
	i = -i
	Me += i * fq[i]
	if Me > S / 2:
		break
	num += fq[i]
Me -= i * fq[i]
num += (S / 2 - Me + 0.1) // i + 1
print(int(num))


import re

def solver(l):
	s = 0
	for i in l:
		s += int(i)
	return s
a = int(input())
ll = re.split(' ', input())
l = []
for i in ll:
	l.append(int(i))
l.sort(reverse=True)
d = 0
i = 0
while True:
	if d > solver(l):
		break
	else:
		d += int(l.pop(0))
		i += 1
print(i)


x = input()
y = input().split()
h = [int(k) for k in y]
h.sort()
res = 0
for k in range(1, len(h) + 1):
	if sum(h[-k:]) > sum(h) // 2:
		res = k
		print(res)
		break


from functools import reduce

def solve(p, curr):
	(remain, num) = p
	if remain < 0:
		return p
	return (remain - curr, num + 1)
input()
coins = sorted(map(int, input().split()), key=lambda x: -x)
s = sum(coins)
(_, ans) = reduce(solve, coins, (s // 2, 0))
print(ans)


n = int(input())
coins = [int(i) for i in input().split()]
l = 101 * [0]
total = 0
n_coin = 0
value_coin = 0
stop_value = 0
for i in range(n):
	total += coins[i]
	l[int(coins[i])] += 1
aver = total // 2
for value in range(100, 0, -1):
	if l[value] == 0:
		continue
	if l[value] * value + value_coin > aver:
		stop_value = value
		break
	value_coin += l[value] * value
	n_coin += l[value]
for j in range(1, l[stop_value] + 1):
	if j * stop_value + value_coin > aver:
		n_coin += j
		break
print(n_coin)


f = lambda : map(int, input().split())
n = int(input())
s = 0
a = list(f())
a.sort()
for i in a:
	s += i
ss = 0
c = 0
for i in range(len(a) - 1, -1, -1):
	ss += a[i]
	c += 1
	if ss > s - ss:
		break
print(c)


x = int(input(''))
r = input('').split(' ')
r = [int(x) for x in r]
r.sort()
summ = 0
for g in range(len(r)):
	summ += r[g]
count = 0
needed = 0
if summ % 2 == 0:
	needed = summ / 2
else:
	needed = summ // 2
ans = 0
for g in range(len(r) - 1, -1, -1):
	count += r[g]
	ans += 1
	if count > needed:
		print(ans)
		break


n = int(input())
l = sorted(list(map(int, input().rstrip().split())), reverse=True)
s = sum(l)
ans = 0
dummy = 0
i = 0
while i < n and dummy + l[i] <= s // 2:
	dummy += l[i]
	ans += 1
	i += 1
if i < n:
	ans += 1
print(ans)


n = int(input())
lst = list(map(int, input().split()))
x = 0
f1 = 0
lst.sort(reverse=1)
for i in range(0, n):
	if f1 <= sum(lst) / 2:
		f1 += lst[i]
		x += 1
print(x)


n = int(input())
a1 = [int(i) for i in input().split()]
(t, t1, c) = (0, 0, 0)
t = sum(a1)
a2 = sorted(a1)
a = a2[::-1]
for i in range(0, n):
	t1 += a[i]
	c += 1
	if t1 > t - t1:
		break
print(c)


n = int(input())
arr = list(map(int, input().split(' ')))
total = sum(arr)
arr.sort()
cur = 0
i = len(arr) - 1
count = 0
while cur <= total and i >= 0:
	cur += arr[i]
	total -= arr[i]
	i -= 1
	count += 1
print(count)


coins = []
total = 0
n = 0
coins_no = int(input())
s = input()
coins[0:coins_no] = s.split(' ')
for i in range(coins_no):
	coins[i] = int(coins[i])
	present = coins[i]
	total += present
half = total / 2
total = 0
coins.sort(reverse=True)
for i in range(coins_no):
	n += 1
	total += coins[i]
	if total > half:
		break
print(str(n))


n = int(input())
a = [int(x) for x in input().split()]
l = len(a)
j = 0
sum = 0
c = 0
sum1 = 0
sort = False
while sort == False:
	sort = True
	i = 1
	while i < l:
		if a[i - 1] < a[i]:
			(a[i - 1], a[i]) = (a[i], a[i - 1])
			sort = False
		i = i + 1
while j < l:
	sum = a[j] + sum
	j = j + 1
average = sum // 2
if sum % 2 == 0:
	while sum1 <= average:
		sum1 = sum1 + a[c]
		c = c + 1
else:
	while sum1 < average + 1:
		sum1 = sum1 + a[c]
		c = c + 1
print(c)


n = int(input())
coins = list(map(int, input().split()))
coins = sorted(coins, reverse=True)
(my, total) = (0, sum(coins))
for i in range(len(coins)):
	my += coins[i]
	total -= coins[i]
	if my > total:
		break
print(str(i + 1))


x = int(input(''))
li = []
coin_val = input('')
coin_val = coin_val.split()
for i in range(0, x):
	li.append(int(coin_val[i]))
li = sorted(li, reverse=True)
summ = 0
num_of_coins = 0
aa = sum(li)
for i in range(0, x):
	num_of_coins += 1
	summ = summ + li[i]
	if summ > aa - summ:
		break
print(num_of_coins)


n = int(input())
m = list(map(int, input().split()))
e = []
sum_0 = 0
sum_1 = 0
k = 0
for i in range(n):
	c = m[i]
	e.append(c)
p = sorted(e, reverse=True)
for i in p:
	sum_0 += i
for i in p:
	sum_1 += i
	k += 1
	if 2 * sum_1 > sum_0:
		break
print(k)


def radix_sort(array):
	max_length = 0
	for x in array:
		if len(str(x)) > max_length:
			max_length = len(str(x))
	for i in range(max_length):
		bucket = [[], [], [], [], [], [], [], [], [], []]
		radix = pow(10, i)
		for x in array:
			bucket[x // radix % 10].append(x)
		array = []
		for n in range(10):
			for element in bucket[n]:
				array.append(element)
	return array
line1 = int(input())
test = input().split(' ')
line2 = [int(x) for x in test]
needed = sum(line2) / 2
line2 = radix_sort(line2)
max = 0
for i in range(1, line1 + 1):
	max += line2[-i]
	if max > needed:
		print(i)
		break


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
total = sum(coins)
coinsum = 0
for i in range(n):
	coinsum += coins[i]
	if coinsum > total / 2:
		break
print(i + 1)


N = int(input())
A = [int(i) for i in input().split()]
sum = 0
for i in A:
	sum += i
A.sort()
x = 0
k = 0
while x <= sum // 2:
	x += A[N - 1]
	k += 1
	N -= 1
print(k)


n = int(input())
coins = [int(x) for x in input().split()]
coins.sort()
coins.reverse()
total = 0
for (i, v) in enumerate(coins):
	total += v
	if 2 * total > sum(coins):
		print(i + 1)
		break


n = int(input())
coins = [int(i) for i in input().split()]
half = 0
for i in coins:
	half += i
half //= 2
coins.sort(reverse=True)
for i in range(n):
	half -= coins[i]
	if half < 0:
		print(i + 1)
		break


n = int(input())
s = input().split(' ')
k = []
a = 0
for i in s:
	k.append(int(i))
k.sort()
for i in range(0, len(s)):
	a = a + int(s[i])
b = 0
j = 0
while b <= a // 2:
	b = b + k[-1]
	j += 1
	k = k[:-1]
print(str(j))


n = int(input())
Array = list(map(int, input().split()[:n]))
Array.sort(reverse=True)
ans = 0
vaalue = 0
total = sum(Array)
for x in range(0, n):
	if vaalue <= total / 2:
		vaalue += Array[x]
		ans += 1
	else:
		break
print(ans)


coinCount = int(input())
coins = list(map(int, input().split()))
coins.sort()
coins.reverse()
runningValue = coins[0]
coinsRemoved = 1
while runningValue <= sum(coins) - runningValue:
	runningValue += coins[coinsRemoved]
	coinsRemoved += 1
print(coinsRemoved)


n = int(input())
coins = list(map(int, input().split(' ')))
coins.sort(reverse=True)
ans = 0
if len(coins) == 1:
	print(1)
else:
	for i in range(len(coins)):
		ans += coins[i]
		if ans > sum(coins[i + 1:]):
			print(i + 1)
			break


n = int(input())
a = list(map(int, input().split(' ')))
val = sum(a)
a.sort()
coin = 0
s = 0
for i in range(n - 1, -1, -1):
	s += a[i]
	coin += 1
	if s > val // 2:
		break
print(coin)


t = int(input())
inp = list(map(int, input().split()))
inp.sort(reverse=True)
for i in range(0, len(inp) + 1):
	if sum(inp[:i]) > sum(inp[i:]):
		print(i)
		break


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
sm = sum(l)
count = 0
b = 0
for i in l:
	b += i
	count += 1
	if b * 2 > sm:
		break
print(count)


t = int(input())
coins = [int(s) for s in input().split()]
coins = sorted(coins, reverse=True)
total = sum(coins)
twin1 = 0
twin2 = total
i = 0
while twin1 <= twin2:
	twin1 += coins[i]
	twin2 -= coins[i]
	i += 1
print(i)


n = int(input())
s = temp = alp = count = 0
lst = list(map(int, input().strip().split(' ')))[:n]
for i in range(n):
	s += lst[i]
for i in range(n - 1):
	for j in range(n - i - 1):
		if lst[j] > lst[j + 1]:
			temp = lst[j]
			lst[j] = lst[j + 1]
			lst[j + 1] = temp
while s >= alp:
	alp += lst[n - 1]
	s -= lst[n - 1]
	count += 1
	n -= 1
print(count)


n = input()
nums = sorted([int(x) for x in input().split()])
total = sum(nums)
left = 0
for (i, value) in enumerate(nums[::-1]):
	left += value
	if left > total - left:
		print(i + 1)
		break


no = int(input())
a = list(map(int, input().split()))
s1 = 0
s2 = 0
n = 1
a.sort(reverse=True)
while s1 <= s2:
	p = a[0:n]
	q = a[n:]
	s1 = sum(p)
	s2 = sum(q)
	n += 1
print(n - 1)


n = int(input())
list = input().split()
(i, j) = (0, 0)
for i in range(0, n - 1):
	for j in range(i, n):
		if int(list[i]) < int(list[j]):
			(list[i], list[j]) = (list[j], list[i])
num = 0
for num in range(0, n):
	num += 1
	(a, b, p, q) = (0, num, 0, 0)
	for a in range(0, num):
		p += int(list[a])
		a += 1
	for b in range(num, n):
		q += int(list[b])
		b += 1
	if p > q:
		break
print(a)


n = int(input())
l = list(map(int, input().split()))
l.sort()
h = []
d = 0
while d >= 0:
	t = l.pop()
	h.append(t)
	d = sum(l) - sum(h)
print(len(h))


(n, coins) = [sorted(map(int, input().split()), reverse=True) for _ in range(2)]
my_coins = 0
coins_counter = 0
while my_coins <= sum(coins) / 2:
	my_coins += coins[coins_counter]
	coins_counter += 1
print(coins_counter)


n = int(input())
coins = [int(s) for s in input().split(' ')]
coins.sort()
coins = coins[::-1]
total = sum(coins)
share = 0
count = 0
while share <= total / 2:
	count += 1
	share += coins[count - 1]
print(count)


def judge(n):
	global sumall
	global myall
	sumall = sumall - list2[int(n)]
	myall = myall + list2[int(n)]
	if myall <= sumall:
		return judge(int(n) + 1)
	else:
		return n + 1
n = input()
str1 = input()
list1 = str1.split(' ')
list2 = []
myall = 0
for i in list1:
	list2.append(int(i))
list2 = sorted(list2, reverse=True)
sumall = sum(list2)
print(judge(0))


n = int(input())
line = input()
data = line.split()
data = [int(x) for x in data]
data.sort(reverse=True)
ans = 0
count = 0
for i in data:
	count += i
count /= 2
for i in data:
	count -= i
	ans += 1
	if count < 0:
		break
print(ans)


n = int(input())
a = list(map(int, input().split()))
a.sort()
a = a[::-1]
for (i, j) in enumerate(a):
	if sum(a[:i + 1]) > sum(a[i + 1:]):
		print(i + 1)
		break
	else:
		continue


n = int(input())
e = list(map(int, input().split()))
k = sum(e) // 2 + 1
e.sort(reverse=True)
Sum = 0
for i in range(n):
	Sum += e[i]
	if Sum >= k:
		print(i + 1)
		break


a = int(input(''))
b = sorted(list(map(int, input('').split())))
h = 0
count = 0
while h <= sum(b):
	h = h + b.pop()
	count += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
sumall = 0
for i in a:
	sumall += i
mysum = 0
count = 0
while mysum <= sumall:
	mysum += max(a)
	sumall -= max(a)
	a.remove(max(a))
	count += 1
print(count)


input()
hek = sorted([int(i) for i in input().split(' ')], reverse=True)
i = 1
while True:
	if sum(hek[:i]) > sum(hek) / 2:
		break
	i += 1
print(i)


x = int(input())
a = list(map(int, input().split(' ')))
a.sort()
x = sum(a)
cnt = 0
m = -1
c = 0
while cnt <= x:
	cnt += a[m]
	x -= a[m]
	m -= 1
	c += 1
print(c)


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
temp = []
for i in range(n):
	if sum(temp) <= sum(l):
		temp.append(l[i])
		l[i] = 0
print(len(temp))


n = int(input())
array = list(map(int, input().strip().split()))
array.sort(reverse=True)
sums = sum(array)
curr_sum = 0
for i in range(len(array)):
	curr_sum += array[i]
	if curr_sum > sums - curr_sum:
		print(i + 1)
		break


a = input()
b = []
count = 0
total1 = 0
for i in input().split():
	b.append(int(i))
d = sorted(b, reverse=True)
for c in d:
	total1 += c
	count += 1
	total2 = 0
	for e in d[count:]:
		total2 += e
	if total1 > total2:
		print(count)
		break
	else:
		continue


import math
n = int(input())
data = list(map(int, input().split()))
count = 0
for i in range(n):
	count += int(data[i])
cnt = 0
tmp = 0
data.sort()
for i in range(n - 1, -1, -1):
	if tmp <= count:
		tmp += int(data[i])
		count -= int(data[i])
		cnt += 1
	else:
		break
print(cnt)


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
if True:
	i = 0
	j = n - 1
	sum1 = 0
	sum2 = 0
	c = 1
	sum1 = l[i]
	sum2 = l[j]
	while i < j:
		if sum1 <= sum2:
			i += 1
			sum1 += l[i]
			if j < n - 1:
				sum2 -= l[j]
				j += 1
			c += 1
		else:
			j -= 1
			sum2 += l[j]
	print(c)


a = int(input())
b = sorted(map(int, input().split()))
c = d = 0
while c <= sum(b):
	c += b.pop()
	d += 1
print(d)


n = int(input())
coins = list(map(int, input().strip().split()))
coins = list(reversed(sorted(coins)))
for i in range(1, len(coins) + 1):
	if sum(coins[:i]) > sum(coins[i:]):
		print(len(coins[:i]))
		break


n = int(input())
inp = list(map(int, input().split()))
out = []
inp.sort(reverse=True)
for i in range(len(inp)):
	if sum(out) > sum(inp) / 2:
		break
	else:
		out.append(inp[i])
print(len(out))


n = int(input())
a = list(map(int, input().split(' ')))
ss = 0
for m in range(0, n):
	ss += a[m]
for i in range(0, n):
	for j in range(0, n - 1):
		if a[j] < a[j + 1]:
			x = a[j]
			a[j] = a[j + 1]
			a[j + 1] = x
for k in range(1, n + 1):
	s = 0
	for l in range(0, k):
		s += a[l]
	if 2 * s > ss:
		print(k)
		break


n = int(input())
coins = [int(i) for i in input().split()]
total = sum(coins)
yours = []
while sum(yours) <= total // 2:
	yours.append(max(coins))
	coins.remove(max(coins))
print(len(yours))


n = int(input())
alis = [int(_) for _ in input().split()]
half = sum(alis) / 2
alis.sort(reverse=True)
tot = 0
i = 0
while tot <= half:
	tot += alis[i]
	i += 1
print(i)


n = int(input())
arr = [int(x) for x in input().split()]
sum1 = sum(arr)
arr.sort()
sum1 = sum1 // 2
count = 0
sum2 = 0
while sum2 <= sum1:
	count += 1
	sum2 += arr[n - count]
print(count)


total_n_coins = input()
coins = [int(i) for i in input().split()]
total = sum(coins)
if total % 2 == 0:
	target_value = total / 2 + 1
elif total % 2 == 1:
	target_value = total // 2 + 1
coins.sort(reverse=True)
money = 0
n_coins = 0
while money < target_value:
	money += coins.pop(0)
	n_coins += 1
print(n_coins)


c = int(input())
a = [int(x) for x in input().split()]
b = sorted(a)
e = b[::-1]
d = 0
g = 0
for i in range(c):
	d = d + e[i]
f = d // 2
for i in range(c):
	g = g + e[i]
	if g > f:
		break
print(i + 1)


n = int(input())
ar = list(map(int, input().split(' ')))[:n]
ar.sort()
num_a = -1
num_b = 0
sum_a = 1
sum_b = 0
i = 1
while sum_b < sum_a or sum_b == sum_a:
	sum_b = sum(ar[-i:])
	num_b = len(ar[-i:])
	sum_a = sum(ar[:-i])
	num_a = len(ar[:-i])
	i += 1
print(num_b)


n = int(input())
coins = [int(x) for x in input().split()]
s = 0
p = 0
q = 0
for i in coins:
	s += i
s = s / 2
a = len(coins)
for j in range(a):
	p += max(coins)
	q += 1
	if p > s:
		print(q)
		break
	else:
		b = max(coins)
		coins.pop(coins.index(b))


import sys
import math

def m(val):
	return int(val)
a = int(sys.stdin.readline())
nums = sys.stdin.readline().strip().split(' ')
sum = 0
for i in range(a):
	val = int(nums[i])
	nums[i] = val
	sum += val
sum = sum / 2
nums.sort(reverse=True)
c = 0
t = 0
for i in range(a):
	c += nums[i]
	t += 1
	if c > sum:
		break
print(t)


n = int(input())
b = [int(i) for i in input().split()]
b.sort(reverse=True)
s = 0
c = 0
summ = sum(b) / 2
for i in range(n):
	if s <= summ:
		s += b[i]
		c += 1
		continue
	else:
		break
print(c)


n = int(input())
l = list(map(int, input().split()))
l.sort()
count = 0
c = 0
while c <= sum(l):
	c += l.pop()
	count += 1
print(count)


n = int(input())
p = [int(x) for x in input().split()]
p.sort(reverse=True)
req = sum(p) // 2
count = 0
sum = 0
for y in p:
	if not sum > req:
		sum = sum + y
		count += 1
	else:
		break
print(count)


n = int(input())
arr = [int(x) for x in input().split()]
arr.sort(reverse=True)
for i in range(1, n):
	if sum(arr[0:i]) > sum(arr[i:]):
		print(i)
		exit()
print(n)


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
su = sum(a) // 2
(c, s2) = (0, 0)
for i in range(n - 1, -1, -1):
	s2 += a[i]
	c += 1
	if s2 > su:
		print(c)
		break


n = int(input())
l = list(map(int, input().split()))
n = sum(l) // 2
l.sort(reverse=True)
z = 0
s = 0
for i in l:
	s += i
	z += 1
	if s > n:
		break
print(z)


n = int(input())
x = list(map(int, input().split()))
tsum = 0
for i in x:
	tsum += i
hsum = tsum / 2
mysum = 0
c = 0
while mysum <= hsum:
	maxx = max(x)
	mysum += maxx
	x.remove(maxx)
	c += 1
print(c)


n = int(input())
b = list(map(int, input().split()))
b.sort(reverse=True)
m = b[0]
l = 1
sum = 0
for i in range(n):
	sum += b[i]
for i in range(n - 1):
	if m <= sum - m:
		m += b[i + 1]
		l = l + 1
	else:
		break
print(l)


n = int(input())
a = list(map(int, input().split()))
s = sum(a) / 2
evil_twin = 0
a.sort(reverse=True)
for i in range(n):
	evil_twin += a[i]
	if evil_twin <= s:
		continue
	else:
		break
print(i + 1)


def greaterThan(coins):
	coins.sort(reverse=True)
	myCoins = 0
	i = 0
	while sum(coins[:i]) <= sum(coins[i:]):
		i += 1
	return len(coins[:i])
n = int(input())
coins = list(map(int, input().split(' ')))
print(greaterThan(coins))


n = int(input())
a = list(map(int, input().split()))
a.sort()
su = 0
for i in range(n):
	su = a[n - i - 1] + su
	bu = 0
	for j in range(n - i - 1):
		bu = a[j] + bu
	if su > bu:
		break
print(i + 1)


def meu_map(lista):
	for i in range(len(lista)):
		lista[i] = int(lista[i])

def bubblesort(lista):
	for j in range(len(lista) - 1):
		for i in range(len(lista) - 1):
			if lista[i] > lista[i + 1]:
				(lista[i], lista[i + 1]) = (lista[i + 1], lista[i])

def min_moedas(lista):
	flag = -2
	soma_maiores = lista[-1]
	soma_menores = 0
	for i in range(len(lista) - 1):
		soma_menores += lista[i]
	while True:
		if soma_maiores > soma_menores:
			break
		soma_maiores += lista[flag]
		soma_menores -= lista[flag]
		flag -= 1
	return -flag - 1
num_moedas = int(input())
moedas = input().split()
meu_map(moedas)
bubblesort(moedas)
print(min_moedas(moedas))


n = input()
n = int(n)
list = [int(n) for n in input().split()]
b = 1
y = max(list)
x = list.index(y)
del list[x]
while sum(list) >= y:
	y = y + max(list)
	a = list.index(max(list))
	del list[a]
	b = b + 1
print(b)


n = int(input())
d = input()
id = 0
ide = 0
data = [int(a) for a in d.split()]
for s in range(n):
	id += data[s]
data.sort()
data.reverse()
for s in range(n):
	ide += data[s]
	if id // 2 + 1 <= ide:
		print(s + 1)
		quit()


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
batas = sum(a) / 2
if n == 1:
	print(n)
else:
	i = 0
	jumlah_koin = 0
	koin_diambil = 0
	while i < n:
		if jumlah_koin <= batas:
			jumlah_koin += a[i]
			koin_diambil += 1
			i += 1
		else:
			break
	print(koin_diambil)


import bisect
import decimal
from decimal import Decimal
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate
decimal.getcontext().prec = 46

def primeFactors(n):
	prime = set()
	while n % 2 == 0:
		prime.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.add(i)
			n = n // i
	if n > 2:
		prime.add(n)
	return list(prime)

def getFactors(n):
	factors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n // i)
		i = i + 1
	return factors

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
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num

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

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

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

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

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def solve():
	n = int(input())
	arr = list_input()
	arr.append(0)
	arr.sort()
	prefix = []
	summ = 0
	for i in arr:
		summ += i
		prefix.append(summ)
	i = n
	count = ans = 0
	while i > 0 and ans <= prefix[i]:
		count += 1
		ans += arr[i]
		i -= 1
	print(count)
t = 1
for _ in range(t):
	solve()


n = int(input())
a = sorted([int(i) for i in input().split()])
c = 0
c1 = sum(a)
i = len(a) - 1
while c <= c1:
	c += a[i]
	c1 -= a[i]
	i -= 1
print(len(a) - (i + 1))


_ = input()
a = [int(_) for _ in input().split()]
x = sum(a) // 2
c = 0
mm = 0
a.sort(reverse=True)
while mm <= x:
	mm += a[c]
	c += 1
print(c)


n = int(input())
k = sorted(map(int, input().split()))
f = 0
for i in range(n):
	f += k[n - 1 - i]
	if f > sum(k) // 2:
		print(i + 1)
		break


n = int(input())
a = list(map(int, input().strip().split()))
a.sort()
s = sum(a)
ans = 0
cnt = 0
for i in range(n - 1, -1, -1):
	ans += a[i]
	s -= a[i]
	cnt += 1
	if ans > s:
		break
print(cnt)


n = int(input())
liste = list(map(int, input().split(' ')))
liste.sort(reverse=True)
amount = list()
a = 0
for element in liste:
	a += element
	amount.append(a)
a = 0
for i in range(len(amount)):
	if amount[len(amount) - 1] - amount[i] < amount[i]:
		a = i + 1
		break
print(a)


a = int(input())
l = []
l = map(int, input().split())
l = sorted(l)
sum1 = 0
sum2 = 0
for i in l:
	sum1 += i
lenth = len(l)
e = lenth
while lenth > 0:
	i = l[lenth - 1]
	sum2 += i
	lenth -= 1
	if 2 * sum2 > sum1:
		ans = e - lenth
		lenth = 0
print(ans)


flag = 0
n = 0
c = 0
input()
l = list(map(int, input().split()))
l.sort()
while flag != 1:
	if n <= sum(l):
		c += 1
		n += l.pop(-1)
	else:
		flag = 1
print(c)


import math

def main():
	n = int(input())
	arr = list(map(int, input().split()))
	arr = sorted(arr, reverse=True)
	arr.append(0)
	for i in range(len(arr) - 1):
		if sum(arr[:i + 1]) > sum(arr[i + 1:]):
			print(len(arr[:i + 1]))
			return
main()


input()
a = [int(i) for i in input().split()]
a.sort(reverse=True)
s = sum(a)
my = 0
for i in range(len(a)):
	my += a[i]
	if 2 * my > s:
		print(i + 1)
		break


n = int(input())
a_list = list(map(int, input().split()))
cnt = 0
ans = 0
a2 = sorted(a_list)
a_sum = sum(a_list) // 2
while ans <= a_sum:
	cnt += 1
	ans += a2[n - cnt]
print(cnt)


n = int(input())
a = [int(i) for i in input().split()]
alist = []
aremain = 0
for i in range(n):
	alist += [a[i]]
	aremain += a[i]
alist = sorted(alist, reverse=True)
atake = 0
for i in range(n):
	atake += alist[i]
	aremain += alist[i] * -1
	if atake > aremain:
		break
print(i + 1)


number_of_coins = int(input())
coin_values = input().split(' ')
counter = 0
value_1 = 0
value_2 = 0
for i in range(len(coin_values)):
	coin_values[i] = int(coin_values[i])
	value_2 += coin_values[i]
while value_1 <= value_2:
	maximum = max(coin_values)
	value_1 += int(maximum)
	value_2 -= int(maximum)
	coin_values.remove(maximum)
	counter += 1
print(counter)


input()
a = [x for x in map(int, input().split())]
a = list(sorted(a))[::-1]
res = 0
for i in range(len(a)):
	if res + a[i] > sum(a[i + 1:]):
		print(i + 1)
		break
	else:
		res += a[i]


import copy
n = int(input())
a = [int(x) for x in input().split(' ')]
sorted_a = sorted(a)
sorted_a.reverse()
sum_all_coins = sum(a)
for i in range(len(a)):
	value = sum(sorted_a[:i + 1])
	if value * 2 > sum_all_coins:
		print(i + 1)
		break


coins_number = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
coins_lowest_half = coins[coins_number // 2:]
coins_biggest_half = coins[:coins_number // 2]
result = len(coins_biggest_half)
if sum(coins_biggest_half) <= sum(coins_lowest_half):
	result += 1
while sum(coins_biggest_half) > sum(coins_lowest_half):
	if sum(coins_biggest_half[:-1]) > sum(coins_lowest_half) + coins_biggest_half[-1]:
		coins_lowest_half.append(coins_biggest_half[-1])
		del coins_biggest_half[-1]
		result -= 1
	else:
		break
print(result)


import sys
input = sys.stdin.readline

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

def invr():
	return list(map(int, input().split()))
no = inp()
values = invr()
values.sort(reverse=True)
total = sum(values)
myShare = 0
for i in range(no):
	myShare += values[i]
	if total // 2 < myShare:
		print(i + 1)
		break


n = input()
c = list(map(int, input().split()))
x = 0
w = 0
y = sum(c)
c.sort(reverse=True)
for i in range(0, len(c)):
	x = x + c[i]
	y = y - c[i]
	w += 1
	if x > y:
		print(w)
		break


n = int(input())
l = [int(i) for i in input().split()]
l = sorted(l)
l = l[::-1]
total = sum(l)
result = 0
count = 0
for i in l:
	result += 1
	count += i
	if count > total / 2:
		break
print(result)


l = int(input())
s = [int(x) for x in input().split()]
m = sum(s)
s.sort()
v = 0
for i in range(l):
	v += s[l - i - 1]
	if 2 * v > m:
		break
print(i + 1)


n = int(input())
coins = list(map(int, input().split()))
coins = sorted(coins, reverse=True)
money = []
k = 0
count = 0
while k < len(coins):
	money.append(coins[k])
	count += 1
	if sum(money) > sum(coins[k + 1:]):
		print(count)
		break
	k += 1


n = int(input())
a = sorted(list(map(int, input().split(' '))), reverse=True)
m = 0
i = 0
while sum(a) >= m and i < len(a):
	m += a[i]
	a[i] = 0
	i += 1
print(i)


a = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
su = 0
count = 0
for i in range(a):
	su += l[i]
	count += 1
	if su > sum(l[i + 1:]):
		break
print(count)


a = int(input())
coins = list(map(int, input().split()))
mycoin = 0
total = 0
coins.sort()
for x in coins:
	total += x
while total >= mycoin:
	mycoin += coins[-1]
	total += -coins[-1]
	coins.pop(-1)
print(a - len(coins))


a = int(input())
s = input().split()
fin = []
for i in s:
	fin.append(int(i))
fin.sort()
for i in range(a):
	if sum(fin[0:i + 1]) < sum(fin[i + 1:]):
		continue
	else:
		print(str(a - i))
		break


x = int(input())
y = map(int, input().split())
y = list(y)
y = sorted(y, reverse=True)
my = [0]
i = 0
while sum(my) <= sum(y):
	my.append(y[i])
	y.pop(i)
print(len(my) - 1)


n = int(input())
values = [int(x) for x in input().split()]
list1 = []
num = 0
for i in range(n):
	list1.append(values[i])
	num += values[i]
list1.sort(reverse=True)
sum1 = 0
for i in range(n):
	sum1 += list1[i]
	if sum1 > num - sum1:
		print(i + 1)
		break


n = int(input())
arr = map(int, input().strip().split())
list1 = list(arr)
list1.sort()
list1.reverse()
sum = 0
for i in list1:
	sum += int(i)
sum1 = 0
sum2 = 0
for i in range(len(list1)):
	sum1 += list1[i]
	sum2 = sum - sum1
	if sum1 > sum2:
		break
print(i + 1)


t = int(input())
arr = [int(x) for x in input().split()]
S = 0
arr.sort(reverse=True)
T = sum(arr) // 2
for i in range(t):
	S += arr[i]
	if S > T:
		print(i + 1)
		break


n = int(input())
coins = input().split()
coins = list(map(int, coins))
coins.sort(reverse=True)
m = 0
sumc = 0
summ = 0
for i in range(0, n):
	sumc = sumc + int(coins[i])
	i += 1
while m < n:
	summ = summ + int(coins[m])
	if summ > sumc / 2:
		break
	else:
		m += 1
print(m + 1)


s = input()
s = list(map(int, input().split()))
summ = sum(s)
s.sort()
summ = summ // 2
summ += 1
s.reverse()
x = 0
ans = -1
for i in range(len(s)):
	if x < summ:
		x += s[i]
	else:
		ans = i
		break
if ans == -1:
	print(len(s))
else:
	print(ans)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
t = sum(a)
o = 0
i = n - 1
count = 0
while t >= o:
	t = t - a[i]
	o = o + a[i]
	i = i - 1
	count = count + 1
print(count)


n = input()
A = list(map(int, input().split()))
A.sort()
m = 0
for i in A:
	m += i
k = int(m / 2) + 1
l = 0
j = 0
while l < k:
	l += A[-1]
	del A[-1]
	j += 1
print(j)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
i = 1
while i < len(a):
	a[i] = a[i] + a[i - 1]
	i += 1
i = 0
while i < len(a):
	if a[i] > a[len(a) - 1] // 2:
		break
	i += 1
print(i + 1)


t = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
sumOfCoins = sum(coins)
mine = 0
countOfCoins = 0
for x in coins:
	mine += x
	countOfCoins += 1
	if mine > sumOfCoins - mine:
		break
print(countOfCoins)


n = int(input())
sp = list(map(int, input().split()))
sm1 = sum(sp)
sp.sort(reverse=True)
for i in range(1, n + 1):
	sm2 = sum(sp[:i])
	if sm1 - sm2 < sm2:
		print(i)
		break


import math
n = int(input())
a = input().split()
l = list(map(int, a))
l = sorted(l)
s = 0
c = 0
res = 0
s = sum(l)
for i in l[::-1]:
	c += i
	res += 1
	if c > s / 2:
		break
print(res)


n = input('')
values = input('')
coins = list(map(int, values.split(' ')))

def coinsAmt(coins):
	coinsObt = []
	while sum(coinsObt) <= sum(coins):
		coinsObt.append(max(coins))
		coins.remove(max(coins))
	return len(coinsObt)
print(coinsAmt(coins))


z = int(input())
a = list(map(int, input().rstrip().split(' ')))
a.sort()
h1 = z - 1
while True:
	if z < 2:
		print(z)
		break
	elif sum(a[:h1]) < sum(a[h1:]):
		print(len(a[h1:]))
		break
	else:
		h1 = h1 - 1


def coins(a, list):
	if a < 2:
		return a
	else:
		sums = 0
		for i in list:
			sums += int(i)
		secondSum = 0
		i = 0
		while secondSum <= sums / 2:
			secondSum += int(list[i])
			i += 1
		return i
a = int(input(''))
line = input('')
list = line.split(' ')
list2 = []
for i in list:
	list2.append(int(i))
list2.sort()
list2.reverse()
print(coins(a, list2))


n = int(input())
nums = input().split()
nums = [int(item) for item in nums]
suma = sum(nums)
nums.sort(reverse=True)
sum_monet = 0
answer = 0
while sum_monet <= suma // 2:
	sum_monet += nums[answer]
	answer += 1
print(answer)


n = int(input())
a = list(map(int, input().split()))
c = []
flag = 0
for i in range(n):
	c.append(max(a))
	flag += 1
	a.remove(max(a))
	if sum(c) > sum(a):
		print(flag)
		break


n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 1
k = l[-1]
s = sum(l)
t = 1
while True:
	if s - k < k:
		print(ans)
		exit()
	t += 1
	k += l[n - t]
	ans += 1


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
sum = 0
for i in coins:
	sum += i
twin_1_sum = 0
diff = 0
num_coins = 0
for i in coins:
	twin_1_sum += i
	diff = sum - twin_1_sum
	num_coins += 1
	if twin_1_sum > diff:
		print(num_coins)
		break


n = int(input())
lis = list(map(int, input().split()))
lis.sort(reverse=True)
s = 0
S = sum(lis)
for i in range(n):
	s += lis[i]
	if s > S - s:
		print(i + 1)
		break


total_coin = input()
total_coin = int(total_coin)
money = input()
money = money.split()
total_money = 0
my_money = 0
for i in range(0, total_coin):
	money[i] = int(money[i])
	total_money += money[i]
money = sorted(money)
ans = 0
j = total_coin - 1
while my_money <= total_money / 2:
	my_money += money[j]
	j -= 1
	ans += 1
print(ans)


n = int(input())
a = input().split()
b = sorted([int(i) for i in a])
S = 0
SUM = sum(b)
j = 0
for i in range(1, n + 1):
	if S <= SUM / 2:
		S += b[-i]
		j += 1
print(j)


n = input()
str_0 = input()
list_0 = str_0.split()
list_1 = []
for i in list_0:
	list_1.append(int(i))
list_1.sort(reverse=True)

def findmin(list_1):
	for i in range(len(list_1)):
		if sum(list_1[0:i]) > sum(list_1[i:]):
			return i
	return len(list_1)
print(findmin(list_1))


n = int(input())
a = input().split()
a1 = []
a2 = []
for b in a:
	a1.append(int(b))
for b in a:
	a2.append(int(b))
d = 0
d1 = 0
sm = 0
t = 0
t1 = 0
for s in a1:
	sm += s
while d <= sm / 2:
	d += min(a1)
	a1.remove(min(a1))
	t += 1
while d1 <= sm / 2:
	d1 += max(a2)
	a2.remove(max(a2))
	t1 += 1
if t >= t1:
	print(t1)
else:
	print(t)


def Main():
	n = int(input())
	arr = [int(x) for x in input().split(' ')]
	tot = sum(arr)
	cnt = 0
	tot2 = 0
	for el in reversed(sorted(arr)):
		tot2 += el
		tot -= el
		cnt += 1
		if tot2 > tot:
			break
	print(cnt)
Main()


coin_count = int(input())
coins = [int(i) for i in input().split()]
coins_sorted = sorted(coins)
my_sum = 0
my_min = sum(coins) // 2
my_count = 0
while my_sum <= my_min:
	my_sum += coins_sorted.pop()
	my_count += 1
print(my_count)


def main():
	n = int(input())
	list1 = list(input().split())
	list2 = []
	tot = 0
	take = 0
	for l in list1:
		m = int(l)
		list2 += [m]
	list2.sort()
	list3 = list2[::-1]
	for i in range(n):
		tot += list3[i]
	check = tot / 2
	for k in range(n):
		take += list3[k]
		if take > check:
			break
	print(k + 1)
main()


def main():
	n = int(input())
	A = sorted(map(int, input().rstrip().split()), reverse=True)
	half = sum(A) / 2
	for i in range(1, n + 1):
		if sum(A[:i]) > half:
			print(i)
			break
main()


hm = int(input())
notes = list(input().split(' '))
for i in range(hm):
	notes[i] = int(notes[i])
mid = sum(notes) / 2
notes.sort(reverse=True)
coins = 0
total = 0
money = 0
for i in range(hm):
	coins += 1
	tot = 0
	for j in range(i + 1, hm):
		tot += notes[j]
	total += notes[i]
	if total > tot:
		break
print(coins)


n = int(input())
x = list(map(int, input().split()))
x.sort()
start = 0
end = n - 1
cond = True
val = 0
cnt = 0
while start <= end:
	cnt += 1
	val += x[end]
	if sum(x[start:end]) < val:
		break
	else:
		end -= 1
print(cnt)


n = int(input())
l = list(map(int, input().split()))
s = sum(l)
l.sort()
l.reverse()
com = 0
s1 = 0
for i in l:
	com += 1
	s1 += i
	if s1 > s // 2:
		print(com)
		break


n = int(input())
arr = list(map(int, input().split(' ')))
arr.sort()
arr.reverse()
i = 0
while sum(arr[i:]) >= sum(arr[:i]):
	i = i + 1
print(i)


input()
c = list(map(int, input().split()))
c = sorted(c, reverse=True)
(res, cnt) = (0, 0)
tot = sum(c) // 2
for i in c:
	res += i
	cnt += 1
	if res > tot:
		break
print(cnt)


n = int(input())
a = sorted([int(i) for i in input().split()])[::-1]
s0 = sum(a)
s1 = 0
for i in range(n):
	s1 += a[i]
	s0 -= a[i]
	if s1 > s0:
		print(i + 1)
		break


n = input()
l = list(map(int, input().split()))
total = sum(l)
l.sort()
l.reverse()
c = 0
r = 0
while r <= 0.5 * total and len(l) > 0:
	c += 1
	r += l[0]
	del l[0]
print(c)


n = int(input())
nums = list(map(int, input().split()))
nums = sorted(nums, reverse=True)
s = []
sr = []
s.append(nums[0])
for i in range(1, n):
	s.append(s[i - 1] + nums[i])
nums.reverse()
sr.append(0)
for i in range(1, n):
	sr.append(sr[i - 1] + nums[i - 1])
sr.reverse()
if s[n - 1] <= sr[n - 1]:
	print(n)
	exit(0)
for i in range(n):
	if s[i] > sr[i]:
		print(i + 1)
		exit(0)


n = int(input())
money = sorted(list(map(int, input().split())))
money = money[::-1]
m = 0
c = 1
if len(money) == 1:
	print(1)
elif len(money) <= 2:
	if money[0] == money[1]:
		print(2)
	else:
		print(1)
else:
	for i in range(0, n):
		if m + money[i] > sum(money[i + 1:]):
			print(c)
			break
		else:
			m += money[i]
			c += 1


n = int(input())
li = [int(i) for i in input().split()]
flag = 1
c = 0
s = 0
while flag:
	k = max(li)
	s += k
	li.remove(k)
	m = sum(li)
	c += 1
	if s > m:
		flag = 0
print(c)


n = int(input())
mon = list(map(int, input().rstrip().split()))
money = sorted(mon)
you = 0
bro = sum(money)
count = 0
for i in range(n - 1, -1, -1):
	if you <= bro:
		you += money[i]
		bro -= money[i]
		count += 1
print(count)


n = int(input())
x = list(map(int, input().split()))
s = sum(x) / 2
x.sort()
c = 1
z = max(x)
for i in range(n):
	if s >= z:
		c += 1
		x.pop()
		z += x[-1]
print(c)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
sm = 0
allsum = sum(a)
cnt = 0
for tmp in a:
	cnt += 1
	sm += tmp
	if sm > allsum - sm:
		print(cnt)
		exit()


n = int(input())
coins = []
[coins.append(int(i)) for i in input().split()]
coins = sorted(coins)
coins.reverse()

def meio(array):
	soma = 0
	for i in array:
		soma += i
	return soma / 2
(i, soma) = (0, 0)
while True:
	soma += coins[i]
	if meio(coins) < soma:
		print(i + 1)
		break
	i += 1


from array import array
from sys import stdin
import bisect
from bisect import *
import itertools
from itertools import *

def scan_gen():
	for line in stdin:
		yield from iter(line.split())
scan = scan_gen()

def nint():
	return int(next(scan))

def nintk(k):
	return tuple((nint() for _ in range(k)))

def nfloat():
	return float(next(scan))

def intar_init(size):
	return array('i', [0]) * size

def intar(size=None):
	if size == None:
		size = nint()
	arr = intar_init(size)
	for x in range(size):
		arr[x] = nint()
	return arr

def solve():
	a = sorted(intar(), reverse=True)
	b = [sum(a[:i]) - sum(a[i:]) for i in range(len(a) + 1)]
	print(bisect_left(b, 1))
solve()


x = input()
n = int(x)
i = 0
a = []
str = input()
k = str.split(' ')
i = 0
while i < n:
	a.append(int(k.pop()))
	i += 1
if n == len(a):
	a.sort()
	a.reverse()
	i = 0
	sum = 0
	while i < n:
		sum = sum + a[i]
		i += 1
	i = 0
	j = a[i]
	tot = 1
	while 2 * j <= sum:
		i += 1
		j = j + a[i]
		tot += 1
	print(tot)


def inplst():
	return list(map(int, input().split()))
n = int(input())
l = inplst()
l.sort(reverse=True)
for i in range(1, n + 1):
	if sum(l[:i]) > sum(l[i:]):
		print(i)
		break


import os
import sys
from io import BytesIO, IOBase

def main():
	n = inp()
	a = inlt()
	pref = []
	a = sorted(a, reverse=True)
	now = 0
	tot = sum(a)
	for i in a:
		now += i
		pref.append(now)
	i = 0
	ans = 0
	for i in range(n):
		if pref[i] > tot // 2:
			ans = i
			break
	print(ans + 1)
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 inp():
	return int(input())

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

def insr():
	return input().strip()

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


import os
import sys
from io import BytesIO, IOBase

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def prime(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

def divisors(n):
	i = 1
	div = []
	while i <= math.sqrt(n):
		if n % i == 0:
			if n / i == i:
				div.append(i)
			else:
				div.append(i)
				div.append(n // i)
		i = i + 1
	return div

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	s = sum(a)
	dup = 0
	for i in range(n):
		dup = dup + a[i]
		if dup > s - a[i]:
			return i + 1
		s = s - a[i]

def main():
	print(solve())
	pass
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 = list(map(int, input().split()))
l.sort(reverse=True)
h = len(l)
(s, p) = (0, 0)
for i in range(h):
	s = s + l[i]
s = s / 2
for i in range(h):
	p = p + l[i]
	if p > s:
		print(i + 1)
		break


n = int(input())
a = sorted(map(int, input().strip().split()))
all = sum(a)
c = 0
sum = 0
for el in reversed(a):
	sum += el
	c += 1
	if sum > all / 2:
		break
print(c)


a = int(input())
b = input().split()
c = 0
for i in range(a):
	c = c + int(b[i])
for i in range(a):
	b[i] = int(b[i])
s = 0
b.sort(reverse=True)
d = 0
for i in range(a):
	if s < c // 2 + 1:
		s = s + int(b[i])
		d = d + 1
	else:
		break
print(d)


n = input()
list = sorted(map(int, input().split()), reverse=1)
cost = sum(list)
p = 0
steal = 0
while steal <= cost / 2:
	steal += list[p]
	p += 1
print(p)


n = int(input())
t = list(map(int, input().split()))
t.sort()
p = t[::-1]
q = 0
for k in range(len(p)):
	if sum(p[:k]) > sum(p[k:]):
		print(k)
		q += 1
		break
if q == 0:
	print(len(t))


n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
sum1 = 0
sum2 = 0
coin_count1 = 0
coin_count2 = 0
start = n - 1
last_index_added = n + 1
for i in range(n):
	if last_index_added > i:
		sum1 += a[i]
		coin_count1 += 1
	if start != i:
		for j in range(start, i - 1, -1):
			if sum2 + a[j] < sum1:
				sum2 += a[j]
				start -= 1
				last_index_added = j
			else:
				break
print(coin_count1)


N = int(input())
Coins = list(map(int, input().split()))
Coins.sort(reverse=True)
A = sum(Coins)
for i in range(len(Coins)):
	if sum(Coins[0:i + 1]) > A / 2:
		print(i + 1)
		break


n = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse=True)
total = sum(a)
taken = 0
i = 0
while taken < total or taken == total:
	taken = taken + int(a[i])
	total = total - int(a[i])
	i = i + 1
print(i)


from functools import reduce
n = int(input())
b = [int(i) for i in input().split()][:n]
b = sorted(b)
t = reduce(lambda x, y: x + y, b) // 2
ctr = 0
coin = 0
while True:
	if len(b) > 0:
		coin += b[len(b) - 1]
		del b[len(b) - 1]
		ctr += 1
	if coin > t:
		break
print(ctr)


x = int(input())
y = sorted(list(map(int, input().split())))
sumy = cnt = 0
while sumy <= sum(y):
	sumy += y.pop()
	cnt += 1
print(cnt)


n = int(input())
coinlist = list(map(int, input().rstrip().split()))
tot = sum(coinlist)
half = tot / 2
coinlist.sort(reverse=True)
cnt = 0
one = 0
for i in range(0, len(coinlist)):
	one = one + coinlist[i]
	cnt += 1
	if one > half:
		break
print(cnt)


n = int(input())
coins = list(map(int, input().split()))
res = []

def solve():
	coins.sort(reverse=True)
	res.append(coins.pop(0))
	if sum(res) > sum(coins):
		print(len(res))
	else:
		solve()
if n == 1:
	print(1)
else:
	solve()


N = int(input())
if 1 <= N <= 100:
	M = input().split()
	Q = [int(i) for i in M]
	Q.sort(reverse=True)
	i = 0
	while i < len(Q):
		if sum(Q[:i]) > sum(Q) / 2:
			break
		i += 1
print(i)


n = int(input())
all = list(map(int, input().split()))
all.sort()
for i in range(n):
	remain = sum(all[:n - i - 1])
	get = sum(all[n - i - 1:n])
	if get > remain:
		print(i + 1)
		break


input()
coins = list(map(int, input().split()))
coins.sort(reverse=True)
s1 = 0
s2 = sum(coins)
i = 0
while s1 <= s2:
	s1 += coins[i]
	s2 -= coins[i]
	i += 1
print(i)


import sys

def solve():
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort(reverse=True)
	ans = 0
	take = 0
	asum = sum(a)
	for ai in a:
		ans += 1
		take += ai
		if 2 * take > asum:
			print(ans)
			return
solve()


n = int(input())
coin_input = input().split(' ')
coins = [int(x) for x in coin_input]
coins.sort()
total = sum(coins)
running_sum = 0
for i in range(1, n + 1):
	running_sum += coins[-i]
	if running_sum > total // 2:
		print(i)
		break


def main():
	n = int(input())
	ip = [int(item) for item in input().split(' ')]
	ip.sort(reverse=True)
	tot = sum(ip)
	sum_n = 0
	for i in range(len(ip)):
		sum_n += ip[i]
		if sum_n > tot - sum_n:
			print(str(i + 1))
			exit()
	print(str(len(ip)))
main()


n = int(input())
numbers = [int(num) for num in input().split(' ', n - 1)]
numbers.sort(reverse=-1)
z = sum(numbers)
a = x = t = 0
while a < n:
	x = x + numbers[a]
	t += 1
	if x > z / 2:
		break
	a += 1
print(t)


num = input()
arr = list(map(int, input().split()))
arr.sort()
arr.reverse()
n = sum(arr) / 2
ans = 0
tmp = 0
for i in arr:
	ans += i
	tmp += 1
	if ans > n:
		print(tmp)
		break


n = int(input())
a = [int(x) for x in input().split()]
b = sum(a) / 2
a = sorted(a)
k = 0
for i in range(len(a) - 1, -1, -1):
	if sum(a[i:]) <= b:
		k = k + 1
	else:
		break
print(k + 1)


n = int(input())
coinsValues = [int(i) for i in str(input()).split()]
coinsValues.sort(reverse=True)
total = sum(coinsValues)
for i in range(1, n + 1):
	if sum(coinsValues[:i]) > total - sum(coinsValues[:i]):
		print(i)
		break


def main():
	num = int(input())
	temp_list = input().split(' ')
	coins = []
	for i in range(num):
		coins.append(int(temp_list[i]))
	coins.sort()
	coins_temp = []
	v = sum(coins)
	for i in reversed(range(0, num)):
		coins_temp.append(coins[i])
		x = sum(coins_temp)
		y = v - x
		if x > y:
			break
		del x, y
	print(len(coins_temp))
main()


k = int(input())
mon = list(map(int, input().split()))
mon.sort()
s1 = 0
s2 = mon[-1]
ans = 1
ind = len(mon) - 2
for i in mon[:-1]:
	s1 += i
while s2 <= s1:
	s1 -= mon[ind]
	s2 += mon[ind]
	ans += 1
	ind -= 1
print(ans)


n = int(input())
l = list(map(int, input().split()))
r = 0
e = 0
l.sort(reverse=True)
d = sum(l)
for i in l:
	r = r + i
	e = e + 1
	if r > d // 2:
		break
print(e)


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


n = int(input())
a = list(map(int, input().split(' ')))
a.sort()
sum = 0
for cur in a:
	sum += cur
pref = 0
for i in range(n):
	pref += a[i]
	if pref >= sum - pref:
		print(n - i)
		exit(0)


numberOfCoins = input()
coins = input()
List = coins.split()
coinList = []
for coin in List:
	integer = int(coin)
	coinList.append(integer)
coinList.sort()
total = sum(coinList)
index = len(coinList) - 1
mySum = 0
count = 0
while True:
	count += 1
	mySum = mySum + coinList[index]
	left = total - mySum
	if left < mySum:
		print(count)
		break
	index -= 1


a = int(input())
b = list(map(int, input().split()))
b.sort(reverse=True)
c = 1
for x in range(1, a + 1):
	if len(b) == 1:
		print(c)
		break
	elif sum(b[0:x]) > sum(b[x:]):
		print(c)
		break
	else:
		c += 1


n = int(input())
ss = sorted(list(map(int, input().split(' '))), reverse=True)
s = sum(ss)
fs = 0
i = 0
for x in ss:
	if fs > s:
		break
	s -= x
	fs += x
	i += 1
print(i)


n = int(input())
l1 = list(map(int, input().split()))
l1.sort()
summ = sum(l1) // 2
sum2 = 0
count = 0
for i in range(n - 1, -1, -1):
	sum2 += l1[i]
	count += 1
	if sum2 > summ:
		break
print(count)


num = int(input())
l = list(input().split(' '))
m = [int(l[i]) for i in range(num)]
m.sort()
S = sum(m)
s = 0
c = 0
for i in range(num - 1, -1, -1):
	s += m[i]
	c += 1
	if s > S // 2:
		break
print(c)


NumperOfCoine = int(input())
array1 = []
array2 = []
VlaueOfCoins = input().split()
for x in VlaueOfCoins:
	array1.append(int(x))
array1.sort(reverse=True)
for x in array1[:]:
	array1.remove(x)
	array2.append(x)
	if sum(array1) < sum(array2):
		break
print(len(array2))


def twins(lst):
	(s, c) = (sum(lst), 0)
	for i in range(len(lst) - 1, -1, -1):
		c += lst[i]
		if c > s // 2:
			return len(lst) - i
	return 0
n = int(input())
a = [int(j) for j in input().split()]
print(twins(sorted(a)))


n = int(input())
array = list(map(int, input().split()))
array.sort()
d = sum(array)
b = 0
e = 0
for i in range(n):
	b = b + array[n - 1 - i]
	e = d - b
	if b > e:
		print(i + 1)
		break


import sys

def solve(coins):
	half = 1.0 * sum(coins) / 2
	total = 0
	for (coin_ix, coin_value) in enumerate(sorted(coins, reverse=True)):
		total += coin_value
		if total > half:
			return coin_ix + 1
	return len(coins)

def main():
	coins_num = int(sys.stdin.readline())
	coins = [int(coin) for coin in sys.stdin.readline().strip().split()]
	print(solve(coins))
main()


n = int(input())
coin = input().split()
new = list(map(int, coin))
s = sum(new)
nn = sorted(new, reverse=True)
b = 0
for i in range(n):
	b = b + nn[i]
	if b > int(s / 2):
		x = int(i) + 1
		break
print(x)


n = int(input())
s = str(input()).split()
tot = 0
sbt = 0
m = 0
for i in range(n):
	s[i] = int(s[i])
	tot += s[i]
s.sort()
i = -1
while sbt <= tot / 2:
	sbt += s[i]
	m += 1
	i -= 1
print(m)


n = int(input())
val = input().split()
val = sorted(val)
s = 0
lis = []
for i in val:
	s += int(i)
	lis.append(int(i))
lis = sorted(lis)
ave = s / 2
req = 0
s = 0
for i in lis[::-1]:
	s += i
	req += 1
	if s > ave:
		break
print(req)


n = int(input())
line = [int(j) for j in input().split()]
sum = 0
for i in line:
	sum += i
line = sorted(line, reverse=True)
half = sum / 2
count = 0
ans = 0
for i in range(n):
	if ans > half:
		break
	ans += line[i]
	count += 1
print(count)


n = int(input())
s = [int(a) for a in input().split()]
s.sort(reverse=True)
cnt = 1
ss = s[0]
for i in range(1, len(s)):
	if ss > sum(s[i:]):
		print(cnt)
		break
	else:
		ss = ss + s[i]
		cnt = cnt + 1
if cnt == n:
	print(n)


numOfCoins = int(input())
coinsList = list(map(int, input().split()))
minResult = 0
share = 0
totalSum = sum(coinsList)
coinsList.sort()
while share <= totalSum / 2:
	share += coinsList.pop()
	minResult += 1
print(minResult)


n = int(input())
a = list(input().split(' '))
for x in range(len(a)):
	a[x] = int(a[x])
a.sort()
if len(a) == 1:
	print('1')
	exit(0)
x = len(a) - 1
bcount = 0
suma = 0
sumb = 0
while suma >= sumb:
	suma = 0
	acount = x
	sumb = 0
	bcount = len(a) - x
	for y in a[:x]:
		suma += y
	for y in a[x:]:
		sumb += y
	x -= 1
print(bcount)


n = int(input())
mine = 0
money = [int(x) for x in input().split()]
money.sort(reverse=True)
middle = sum(money) / 2
for i in range(n):
	mine += money[i]
	if mine > middle:
		print(i + 1)
		break


n = int(input())
c = list(map(int, input().split()))
c.sort(reverse=True)
d = 0
i = 0
while d != 1:
	c1 = c[:i + 1]
	c2 = c[i + 1:]
	if sum(c1) > sum(c2):
		d == 1
		break
	i = i + 1
print(len(c1))


n = input()
ai = sorted(map(int, input().split()), reverse=True)
(ans, amount, total) = (0, 0, sum(ai))
for i in ai:
	if amount > total / 2:
		break
	else:
		ans += 1
		amount += i
print(ans)


a = int(input())
b = input().split(' ')
me = 0
twin = 0
for i in range(0, a):
	b[i] = int(b[i])
	twin += b[i]
b.sort(reverse=True)
for i in range(0, a):
	twin -= b[i]
	me += b[i]
	if twin < me:
		print(i + 1)
		break


n = int(input())
c = list(map(int, input().split()))
soma = sum(c)
c.sort()
ans = 0
somaB = 0
for i in reversed(c):
	somaB += i
	resto = soma - somaB
	ans += 1
	if somaB > resto:
		break
print(ans)


nums = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
sidelist = []
while True:
	if sum(coins) + 1 > sum(sidelist):
		sidelist.append(coins.pop(0))
	else:
		break
print(len(sidelist))


n = int(input())
b = 0
a = sorted(list(map(int, input().split())), reverse=True)
a.append(0)
for x in range(1, n + 1):
	b += 1
	if sum(a[:x]) > sum(a[x:]):
		print(b)
		break


coins = int(input())
a = []
a = list(map(int, input().split()))
a.sort(reverse=True)
num_coins = 0
coins_sum = 0
for i in range(coins):
	coins_sum += a[i]
	num_coins += 1
	rem_sum = 0
	for j in range(i + 1, coins):
		rem_sum += a[j]
	if coins_sum > rem_sum:
		break
print(num_coins)


n = int(input())
ls = list(map(int, input().split(' ')))
list.sort(ls)
ls = ls[::-1]
a = 0
k = 0
for i in ls:
	a += i
	k += 1
	if a > sum(ls) - a:
		print(k)
		break


n = int(input())
coin = sorted(map(int, input().split()), reverse=True)
s = 0
total = sum(coin) / 2 + 1
coint = sorted(coin, reverse=True)
for value in range(len(coin)):
	s += coin[value]
	if s >= int(total):
		print(value + 1)
		break


input()
a = list(map(int, input().split()))
a.sort(reverse=True)
b = 0
for i in range(len(a)):
	b += a[i]
	if b > -1 * sum(a) // -2:
		print(i + 1)
		break


n = int(input())
data = list(map(int, input().split()))
nxt = 0
for i in range(1, n):
	j = i - 1
	nxt = data[i]
	while data[j] < nxt and j >= 0:
		data[j + 1] = data[j]
		j = j - 1
		data[j + 1] = nxt
rt_data = sum(data) // 2
rt_data_y = 0
j = 0
while rt_data >= rt_data_y:
	rt_data_y += data[j]
	j += 1
print(j)


n = int(input())
counter = 0
sum1 = 0
sum2 = 0
coins = list(map(int, input().split(' ')))[:n]
coins.sort(reverse=True)
for i in range(len(coins)):
	sum2 = 0
	sum1 += coins[i]
	for j in range(len(coins) - 1, i, -1):
		sum2 += coins[j]
	counter += 1
	if sum1 > sum2:
		break
print(counter)


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


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
total = sum(coins)
taken = []
for i in range(0, n):
	if sum(taken) + coins[i] <= total - sum(taken) - coins[i]:
		taken.append(coins[i])
	else:
		print(len(taken) + 1)
		break


n = int(input())
ar = sorted(list(map(int, input().strip().split())))[::-1]
(c, i) = (0, 0)
while i != n:
	if sum(ar[:i + 1]) > sum(ar[i + 1:]):
		c = i + 1
		break
	else:
		i += 1
		pass
print(c)


n = int(input())
a = list(map(int, input().split()))
b = sorted(a)
c = sum(b)
ans = 0
d = 0
for i in range(n - 1, -1, -1):
	if ans <= c / 2:
		ans = ans + b[i]
		d = d + 1
	else:
		break
print(d)


n = int(input())
L = input().split(' ')
for i in range(n):
	L[i] = int(L[i])
L = sorted(L)[::-1]
sum1 = 0
for i in L:
	sum1 += i
count = 1
while sum(L[:count]) <= sum1 // 2:
	count += 1
print(count)


n = int(input())
s = input().split()
a = []
sum = 0
for i in s:
	a.append(int(i))
	sum += int(i)
a.sort()
total = 0
i = len(a) - 1
while sum - total >= total and i >= 0:
	total += a[i]
	i -= 1
print(len(a) - i - 1)


n = int(input())

def twins(n):
	lis = [int(i) for i in input().split()]
	lis.sort()
	B = 0
	count = 0
	while B <= sum(lis):
		B += lis.pop()
		count += 1
	return count
print(twins(n))


a = int(input())
b = list(map(int, input().split(' ')))
b.sort(reverse=True)
min = 0
count = 1
sum1 = sum(b)
for i in b:
	sum1 -= i
	min += i
	if min <= sum1:
		count += 1
		continue
	else:
		break
print(count)


n = int(input())
a = []
c = list(map(int, input().split()))
a.extend(c)
a.sort(reverse=True)
v = sum(c)
count = 0
ctr = 0
for i in range(n):
	if count <= v / 2:
		count = count + a[i]
		ctr += 1
print(ctr)


def maxi(l):
	m = l[0]
	for i in l:
		if i > m:
			m = i
	return m

def mini(l):
	m = l[0]
	for i in l:
		if i < m:
			m = i
	return m

def mNm(l):
	m = maxi(l)
	l.remove(m)
	c = 1
	while m <= sum(l):
		c += 1
		md = maxi(l)
		m += md
		l.remove(md)
	return c

def main():
	n = int(input())
	mon = [int(c) for c in input().split()]
	print(mNm(mon))
main()


num = int(input())
coins = list(map(int, input().split()))
coins.sort()
total = 0
for i in range(len(coins) - 1, -1, -1):
	total += 1
	if sum(coins[:i]) < sum(coins[i:]):
		break
print(total)


n = int(input())
k = list(map(int, input().split()))
su = 0
for i in range(n):
	su += k[i]
k.sort()
my = 0
myc = 0
for i in range(n - 1, -1, -1):
	my += k[i]
	su -= k[i]
	myc += 1
	if my > su:
		print(myc)
		break


n = int(input())
l = list(map(int, input().split()))
l.sort()
l.reverse()
Sum = sum(l)
Sum2 = 0
cnt = 0
for i in range(len(l)):
	Sum2 = Sum2 + l[i]
	if Sum2 > Sum // 2:
		cnt = cnt + 1
		break
	else:
		cnt = cnt + 1
print(cnt)


from sys import stdin, stdout
from collections import Counter

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

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

def ip():
	return int(stdin.readline().strip())

def op(ans):
	return stdout.write(str(ans) + '\n')
n = ip()
li = ai()
li.sort(reverse=True)
x = sum(li)
ans = 0
coins = 0
for i in li:
	ans += i
	x -= i
	coins += 1
	if x < ans:
		print(coins)
		break


from sys import stdin
n = int(stdin.readline().strip())
coins = list(map(int, stdin.readline().strip().split(' ')))
coins.sort(reverse=True)
rem_coins_sum = sum(coins)
sum = 0
num_coins_taken = 0
for coin in coins:
	if sum <= rem_coins_sum:
		num_coins_taken = num_coins_taken + 1
		sum = sum + coin
		rem_coins_sum = rem_coins_sum - coin
print(num_coins_taken)


import sys
n = int(sys.stdin.readline().strip())
coins = list((int(x) for x in sys.stdin.readline().strip().split(' ')))
result = 0
balance = 0
avg = sum(coins) / 2
coins.sort(reverse=True)
for coin in coins:
	balance += coin
	result += 1
	if balance > avg:
		print(result)
		exit()


input()
num = list(map(int, input().split()))
num.sort(reverse=True)
s = sum(num)
b = 0
c = 0
for i in num:
	if b > s:
		break
	s -= i
	b += i
	c += 1
print(c)


def findTwins(coin):
	coin.sort(reverse=True)
	sum1 = sum(coin)
	maxi = 0
	lenCoin = len(coin)
	i = 0
	while lenCoin != 0:
		maxi += coin[i]
		sum1 -= coin[i]
		if maxi > sum1:
			print(i + 1)
			break
		i += 1
		lenCoin -= 1
size = int(input())
coins = list(map(int, input().split(' ')))
if len(coins) > size:
	print('Invalid input length')
	exit(0)
else:
	findTwins(coins)


n = int(input())
l = list(map(int, input().split()))
s = sum(l) // 2
count = 0
l.sort(reverse=True)
check = 0
for i in range(len(l)):
	if check <= s:
		check += l[i]
		count += 1
print(count)


n = int(input())
coin = [int(i) for i in input().split()]
coin.sort(reverse=True)
for i in range(1, n + 1):
	if sum(coin[0:i]) > sum(coin) / 2:
		print(i)
		break


n = int(input())
coins = input().split()
total = 0
my_sum = 0
number = 0
for i in range(n):
	coins[i] = int(coins[i])
for i in range(n):
	total += coins[i]
while True:
	my_coin = max(coins)
	total -= my_coin
	my_sum += my_coin
	coins.remove(my_coin)
	number += 1
	if my_sum > total:
		break
print(number)


import math
n = int(input())
l = list(map(int, input().split()))
l.sort()
l = l[::-1]
for i in range(n):
	a = sum(l[0:i + 1])
	b = sum(l[i + 1:])
	if a > b:
		print(i + 1)
		break


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


n = int(input(''))
s = input('')
l = s.split()
lst = list()
for x in l:
	x = int(x)
	lst.append(x)
ls = sorted(lst, reverse=True)
total = 0
count = 0
m = len(ls)
for c in range(0, m):
	total = total + ls[c]
	count = count + 1
	sum = 0
	for x in range(c + 1, m):
		sum = sum + ls[x]
	if total > sum:
		break
print(count)


def solve(n, arr):
	arr.sort(reverse=True)
	pre_sum = [0]
	total_sum = sum(arr)
	for i in range(n):
		pre_sum.append(pre_sum[-1] + arr[i])
	pre_sum.pop(0)
	for i in range(n):
		if pre_sum[i] > total_sum / 2:
			return i + 1
n = int(input())
arr = list(map(int, input().split()))
print(solve(n, arr))


n = int(input())
a = list()
a = input().split()
for i in range(len(a)):
	a.insert(i, int(a.pop(i)))
a = sorted(a)
i = len(a) - 1
j = 0
d = 0
e = sum(a)
while d <= e:
	d += a.pop(i)
	e = sum(a)
	j += 1
	i -= 1
print(j)


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
ans = 1
a = l[0]
b = sum(l) - a
i = 1
while b >= a and i < len(l):
	a += l[i]
	b = sum(l) - a
	ans += 1
	i += 1
print(ans)


numberOfCoins = int(input())
coins = sorted([int(ip) for ip in input().split(' ')], reverse=True)
totalValueOfCoins = sum(coins)
yourValue = 0
i = 0
while yourValue <= totalValueOfCoins / 2:
	yourValue = yourValue + coins[i]
	i = i + 1
print(i)


n = int(input())
coins = sorted(list(map(int, input().split())), reverse=True)
s = 0
i = 0
while s <= sum(coins) / 2:
	s += coins[i]
	i += 1
print(i)


import sys
s = sys.stdin.read()
a = [int(i) for i in s.split()]
a.pop(0)
a.sort(reverse=True)
total = sum((i for i in a))
k = 0
for i in range(len(a)):
	k = k + a[i]
	if k > total / 2:
		x = i + 1
		break
print(x)


n = int(input())
v = list(map(int, input().split()))
v.sort()
v.reverse()
(counter, b1, b2, n) = (0, 0, sum(v), 0)
if len(v) == 1:
	print(1)
else:
	for i in range(len(v)):
		b1 += v[i]
		n += 1
		if v[i] > b2 - v[i]:
			counter += 1
			break
		elif b1 + v[i + 1] > b2 - (b1 + v[i + 1]):
			counter += 1 + n
			break
	print(counter)


import sys
n = int(sys.stdin.readline())
a = sys.stdin.readline().split(' ')
b = []
for i in range(0, n):
	b.append(int(a[i]))
b.sort()
k = 1
while sum(b[-k:]) <= sum(b[:-k]):
	k += 1
print(k)


x = input()
list1 = list(map(int, input().split()))
list1.sort(reverse=True)
b = 0
y = 0
z = 0
for a in list1:
	b += a
while 2 * y <= b:
	y += list1[z]
	z += 1
print(z)


n = int(input())
a = list((int(x) for x in input().split()))
a = sorted(a, reverse=True)
i = 0
check = sum(a)
count = 0
pupa = 0
while i < a.__len__():
	pupa += a[i]
	check -= a[i]
	if pupa > check:
		break
	i += 1
print(i + 1)


y = input()
z = sorted(list(map(int, input().split())))
i = len(z) - 1
for x in range(len(z)):
	if sum(z[i:]) > sum(z[0:i]):
		print(len(z[i:]))
		break
	else:
		i -= 1


n = int(input())
x = input()
y = x.split(' ')
l = len(y)
sum0 = 0
for i in range(l):
	sum0 += int(y[i])
for i in range(l):
	y[i] = int(y[i])
y.sort()
sum1 = 0
count = 0
if sum0 % 2 == 0:
	sum0 = sum0 // 2
else:
	sum0 = sum0 // 2
for i in range(l):
	sum1 += int(y[l - 1 - i])
	count += 1
	if sum1 > sum0:
		break
print(count)


n = int(input())
l = sorted([int(i) for i in input().split()])
z = []
c = 0
for i in range(n):
	z.append(l[-1])
	last = sum(z)
	l.remove(l[-1])
	remain = sum(l)
	c += 1
	if last > remain:
		break
print(c)


no_of_coins = int(input())
coins = list(map(int, input().split()))
coins.sort()
x = no_of_coins - 1
while sum(coins[:x]) >= sum(coins[x:]):
	x -= 1
	if x == -1:
		break
print(no_of_coins - x)


from copy import deepcopy
n = int(input())
x = list(map(int, input().split()))
if len(x) == 1:
	print(1)
elif len(x) == 2:
	if x[0] == x[1]:
		print(2)
	else:
		print(1)
else:
	x.sort(reverse=True)
	k = 0
	a = sum(x)
	d = 0
	j = deepcopy(x)
	for i in j:
		b = max(x)
		if d <= a:
			d += b
			a -= b
			k += 1
			x.remove(b)
	print(k)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
s = sum(a) // 2
c = 0
cs = 0
for i in a[-1::-1]:
	if cs <= s:
		c += 1
		cs += i
	else:
		break
print(c)


n = int(input())
l = list(map(int, input().split()))
s = sum(l)
g = 0
j = 0
l = sorted(l)
l = l[::-1]
for i in l:
	g = g + i
	k = s - g
	if g > k:
		break
	j += 1
print(j + 1)


def integerize(arr):
	for i in range(len(arr)):
		arr[i] = int(arr[i])
	return arr

def calc_target(arr):
	sum = 0
	for num in arr:
		sum += num
	target = sum / 2
	return target
n = int(input())
arr = input().split()
arr = integerize(arr)
target = calc_target(arr)
arr.sort()
i = len(arr) - 1
sum = 0
num = 0
while i >= 0 and sum <= target:
	sum += arr[i]
	num += 1
	i -= 1
print(num)


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

def solve(n, coins):
	total = sum(coins)
	current_sum = 0
	num_coins = 0
	coins.sort()
	for i in range(n - 1, -1, -1):
		current_sum += coins[i]
		total -= coins[i]
		num_coins += 1
		if current_sum > total:
			print(num_coins)
			return
solve(n, coins)


n = int(input())
arr = [int(a) for a in input().split()]
arr.sort()
arr.reverse()
for i in range(1, len(arr) + 1):
	if sum(arr[:i]) > sum(arr[i:]):
		print(i)
		break


n = int(input())
coins = list(map(int, input().split()))
total = sum(coins)
coins.sort()
qt = soma = 0
while soma <= total / 2:
	soma += coins.pop()
	qt += 1
print(qt)


n = int(input())
bs = list(map(int, input().strip().split()))[:n]
bs.sort()
c = 1
x = bs.pop()
while 1:
	if x > sum(bs):
		print(c)
		break
	else:
		c = c + 1
		x = x + bs.pop()


TN = 1

def solution():
	n = int(input())
	a = sorted(list(map(int, input().split())), reverse=True)
	ans = 0
	frst = 0
	scnd = sum(a)
	for i in range(n):
		frst += a[i]
		scnd -= a[i]
		if frst > scnd:
			print(i + 1)
			break
while TN != 0:
	solution()
	TN -= 1


import sys
file = sys.stdin.readlines()
line = file[1]
numbers = line.split(' ')
numbers[-1] = numbers[-1].strip()
i = 0
while i < len(numbers):
	numbers[i] = int(numbers[i])
	i += 1
numbers.sort(reverse=True)
total = sum(numbers)
coins = []
for coin in numbers:
	coins.append(coin)
	if sum(coins) > total - sum(coins):
		print(len(coins))
		break


n = int(input())
sum1 = 0
arr = list(map(int, input().split()))
summ = sum(arr)
count = 0
sum0 = 0
for i in range(n):
	sum2 = 0
	if sum1 <= sum0:
		sum1 = sum1 + max(arr)
		sum2 = sum2 + summ - sum1
		sum0 = sum2
		arr.pop(arr.index(max(arr)))
		count += 1
print(count)


n = input()
m = list(map(int, input().split()))
m.sort()
m.reverse()
s = 0
p = 0
if m[0] > sum(m) * 0.5:
	print('1')
else:
	for i in range(0, len(m)):
		s = s + int(m[i])
		if s <= sum(m) * 0.5:
			p = i + 2
	print(p)


n = input()
li = list(map(int, input().split()))
li1 = []
li2 = []
for i in li:
	if i > sum(li) // 2:
		li2 += [i]
	else:
		li1 += [i]
if len(li2) > 0:
	print(1)
else:
	ans = 0
	s = 0
	li1.sort(reverse=True)
	for i in li1:
		ans += 1
		s += i
		if s > sum(li) // 2:
			break
	print(ans)


n = input()
answer = 0
your = 0
coins = sorted([int(x) for x in input().split()])
total = sum(coins)
for i in reversed(coins):
	if your > total - your:
		break
	your = your + i
	answer = answer + 1
print(answer)


k = int(input())
a = list(map(int, input().split()))
summ = sum(a)
mysum = 0
answer = 0
a.sort()
while True:
	if mysum <= summ:
		mysum += a[k - 1]
		summ -= a[k - 1]
		k -= 1
		answer += 1
	else:
		print(answer)
		break


n = int(input())
num = sorted(map(int, input().split()))
(a, b) = (0, -1)
while a <= sum(num) / 2:
	a += num[b]
	b -= 1
print(abs(b + 1))


nCoins = int(input())
coins = [int(coin) for coin in input().split(' ')]
half = sum(coins) / 2
coins.sort(reverse=True)
current = 0
for i in range(0, nCoins):
	current += int(coins[i])
	if current > half:
		print(i + 1)
		break


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
l = l[::-1]
k = sum(l)
coN = 0
s = 0
for i in l:
	s += i
	coN += 1
	if s > k - s:
		break
print(coN)


i = int(input())
cv = input().split()
for j in range(len(cv)):
	cv[j] = int(cv[j])
subtractor = sum(cv)
adder = 0
coinMin = 0
cv.sort(reverse=True)
if len(cv) == 1:
	print(1)
else:
	for k in cv:
		adder += k
		subtractor -= k
		coinMin += 1
		if adder > subtractor:
			print(coinMin)
			break


n = int(input())
numbers = [int(_) for _ in input().split()]
numbers.sort()
quant = 0
total = 0
while total <= sum(numbers):
	for number in numbers:
		if number + total > sum(numbers):
			total += number
			numbers.remove(number)
			break
	else:
		total += numbers.pop()
	quant += 1
print(quant)


n = int(input())
l = sorted(list(map(int, input().split())))
l1 = sum(l) // 2
count = 0
a = 0
for i in range(len(l) - 1, -1, -1):
	a += l[i]
	if a <= l1:
		count += 1
	elif a > l1:
		count += 1
		break
print(count)


n = int(input())
coins = list(map(int, input().split()))
soma = 0
cont = 0
for c in sorted(coins, reverse=True):
	if soma > sum(coins) / 2:
		break
	soma += c
	cont += 1
print(cont)


from __future__ import division, print_function
from collections import *
from math import *
from itertools import *
from time import time
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	n = int(input())
	ar = sorted(map(int, input().split()))
	ar.reverse()
	coins = 0
	sums = 0
	half = sum(ar) / 2
	for i in range(n):
		if sums > half:
			break
		sums += ar[i]
		coins += 1
	print(coins)
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))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())
ai = list(map(int, input().split()))
ai.sort()
s = 0
i = 0
while s <= sum(ai):
	s += ai.pop()
	i += 1
print(i)


n = int(input())
s = [int(elem) for elem in input().split()]
s.sort(reverse=True)
x = sum(s)
k = 0
ans = 0
while ans <= x - ans:
	ans = ans + s[k]
	k = k + 1
print(k)


n = input()
s = input().split(' ')
for i in range(int(n)):
	s[i] = int(s[i])
s.sort(reverse=True)
su = 0
for i in s:
	su += int(i)
count = 0
nums = 0
for i in s:
	nums += int(i)
	count += 1
	if nums * 2 > su:
		break
print(count)


coins = int(input())
values = input().split()
values_array = list(map(int, values))
values_array.sort(reverse=True)
sum = 0
for i in range(0, coins):
	sum += values_array[i]
stolen_coins_count = 0
stolen_coins_sum = 0
for i in range(0, coins):
	if stolen_coins_sum <= sum:
		stolen_coins_count += 1
		stolen_coins_sum += values_array[i]
		sum = sum - values_array[i]
print(stolen_coins_count)


n = int(input())
l = list(map(int, input().split(' ')))
m = n
l.sort()
for i in range(n, 0, -1):
	if sum(l[i:]) > sum(l[:i]) and n - i < m:
		m = n - i
print(m)


from operator import itemgetter, attrgetter, methodcaller
a = int(input())
b = input()
b = b.split(' ')
sum = 0
for i in range(int(len(b))):
	sum += int(b[i])
for i in range(len(b)):
	b[i] = int(b[i])
b.sort(reverse=True)
nado = 0
chet = 0
if sum % 2 == 0:
	nado = sum // 2 + 1
elif sum % 2 != 0:
	nado = sum // 2 + 1
for i in range(int(len(b))):
	nado -= int(b[i])
	chet += 1
	if nado <= 0:
		break
print(chet)


number = list(map(int, input().split()))
coins = list(map(int, input().split()))
(s, l, co) = (0, 0, 0)
for c in coins:
	s += c
coins.sort(reverse=True)
for k in coins:
	co += 1
	l += k
	if l > s - l:
		print(co)
		break


n = int(input())
m = map(int, input().split())
m = sorted(list(m))
s = sum(m)
d = 0
f = 0
for i in range(n):
	if 2 * d <= s:
		d += m[n - 1 - i]
		f += 1
	else:
		break
print(f)


n = int(input())
s = [int(i) for i in input().split()]
s.sort()
s.reverse()
mi = 0
sm = 0
su = sum(s)
for i in range(n):
	sm += s[i]
	mi += 1
	if sm > su / 2:
		break
print(mi)


n = int(input())
li = list(map(int, input().split()))
li.sort(reverse=True)
sum = sum(li)
j = 0
sum2 = 0
while sum2 <= sum // 2:
	sum2 = sum2 + li[j]
	j = j + 1
print(j)
exit()


a = int(input())
l = list(map(int, input().split()))
l.sort()
s = sum(l) // 2
l.reverse()
f = 0
count = 0
for i in range(0, a, 1):
	count += 1
	f += l[i]
	if f > s:
		break
print(count)


n = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
q = sum(arr)
count = 0
g = []
for i in range(len(arr)):
	count = count + arr[i]
	g.append(arr[i])
	if count > q - count:
		break
print(len(g))


import math
s = int(input())
s1 = list(map(int, input().split()))
total = sum(s1) // 2
coin = 0
sum1 = 0
s1.sort(reverse=True)
for i in s1:
	if sum1 + i > total:
		coin += 1
		break
	else:
		sum1 += i
		coin += 1
print(coin)


input()
coins = sorted(map(int, input().split()), reverse=True)
right_sum = sum(coins)
left_sum = 0
i = 0
while left_sum <= right_sum and i < len(coins):
	left_sum += coins[i]
	right_sum -= coins[i]
	i += 1
print(i)


n = int(input())
arr = [int(x) for x in input().split(' ')]
arr.sort()
s = sum(arr)
temp = 0
ans = 0
while temp <= s:
	t = arr.pop()
	temp = temp + t
	s -= t
	ans += 1
print(ans)


n = int(input())
k = list(map(int, input().strip().split()))
k.sort()
s = sum(k) // 2
q = 0
count = 0
for i in range(1, n + 1):
	if q > s:
		break
	else:
		q += k[-i]
		count += 1
print(count)


n = int(input())
coins = [int(x) for x in input().split(' ')]
coins.sort(reverse=True)
k = sum(coins)
s = 0
c = 1
for i in range(n):
	s += coins[i]
	if s > k / 2:
		break
	else:
		c += 1
print(c)


n = int(input())
a = [int(s) for s in input().split()]
s = 0
sp = 0
maxi = -1
ind = 0
k = 0
s1 = 0
for i in range(n):
	s += a[i]
sp = s // 2
for i in range(n):
	maxi = -1
	ind = 0
	for i1 in range(n - i):
		if a[i1] > maxi:
			maxi = a[i1]
			ind = i1
	s1 += maxi
	k += 1
	del a[ind]
	if s1 > sp:
		break
print(k)


_ = input()
coins = list(map(int, input().split()))
s = sum(coins)
v = 0
n = 0
for (n, c) in enumerate(reversed(sorted(coins))):
	v += c
	if v > s / 2:
		break
print(n + 1)


n = int(input())
x = list((int(i) for i in input().strip().split()))
total = 0
s = 0
count = 0
for i in x:
	total += i
x.sort()
for i in range(n - 1, -1, -1):
	s += x[i]
	count += 1
	if s > total / 2:
		break
print(count)


n = int(input())
c = [int(x) for x in input().split()]
c.sort(reverse=True)
v = sum(c) // 2
ans = s = 0
while s <= v:
	s += c[0]
	c = c[1:]
	ans = ans + 1
print(ans)


n = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse=True)
suma = sum(a)
add = 0
num = n
for i in range(n):
	add += a[i]
	if 2 * add > suma:
		num = i + 1
		break
print(num)


n = int(input())
l = list(map(int, input().split()))
l.sort()
c = 1
s = l[n - 1]
j = n - 2
for i in range(n - 1, -1, -1):
	if sum(l) - s < s:
		break
	else:
		s += l[j]
		j -= 1
		c += 1
print(c)


n = int(input())
list = [int(i) for i in input().split()]
list.sort(reverse=True)
(his_sum, your_sum, i) = (sum(list), 0, 0)
while his_sum >= your_sum:
	his_sum -= list[i]
	your_sum += list[i]
	i += 1
print(i)


n = input()
coins = []
s = int(0)
for x in input().split():
	s += int(x)
	coins.append(int(x))
assert int(n) == len(coins)
coins.sort()
coins.reverse()
check = int(0)
for (i, x) in enumerate(coins):
	check += x
	if check > s / 2:
		print(i + 1)
		break


num = int(input())
nums = [int(x) for x in input().split(' ')]
nums.sort(reverse=True)
mini = 0
for (i, x) in enumerate(nums):
	if sum(nums[:i + 1]) > sum(nums[i + 1:]):
		mini = len(nums[:i + 1])
		break
print(mini)


sheeet = 0
sheet = 0
shet = 0
n = int(input())
m = [int(i) for i in input().split()]
m = sorted(m, reverse=True)
for i in range(n):
	sheet += m[i]
for i in range(n):
	if sheeet <= sheet - sheeet:
		shet += 1
		sheeet += m[i]
print(shet)


num = int(input())
line = [int(i) for i in input().split()]
line = sorted(line)
sum_all = 0
for i in range(num):
	sum_all += line[i]
half_sum = sum_all / 2
sum_pick = 0
count = 0
for i in range(num):
	sum_pick += line[num - i - 1]
	count += 1
	if sum_pick > half_sum:
		print(count)
		break


no_of_coins = int(input())
coins = [0] * no_of_coins
total_sum = 0
inputs = map(int, input().split())
for index in range(no_of_coins):
	coins[index] = next(inputs)
	total_sum += coins[index]
coins.sort(reverse=True)
half_sum = total_sum / 2
sum = 0
count = 0
while sum <= half_sum:
	sum += coins[count]
	count += 1
print(count)


number_of_coins = input()
coins = input()
total = 0
temp = 0
temp_coins_q = 0
coins = coins.split(' ')
coins = list(map(int, coins))
coins = sorted(coins, reverse=True)
total = sum(coins)
for i in range(0, len(coins)):
	temp = temp + coins[i]
	temp_coins_q = temp_coins_q + 1
	if temp > total - temp:
		break
print(temp_coins_q)


import sys
import math

def main():
	n = int(sys.stdin.readline().strip())
	coins = list(map(int, sys.stdin.readline().strip().split()))
	coins.append(0)
	coins.sort(reverse=True)
	for i in range(len(coins) - 1):
		if sum(coins[:i + 1]) > sum(coins[i + 1:]):
			break
	print(i + 1)
main()


n = int(input())
values = list(map(int, input().split()))
s = sum(values)
k = 0
c = 0
for i in sorted(values, reverse=True):
	if k < s // 2 + 1:
		k += i
		c += 1
print(c)


def sum_list(a):
	s = 0
	for i in a:
		s += i
	return s
n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
b = []
k = 0
while sum_list(a) >= sum_list(b):
	k += 1
	b.append(a[0])
	a.pop(0)
print(k)


n = int(input())
ar = list(map(int, input().split()))
ar1 = []
count = 0
s = 0
for i in range(n):
	count = count + ar[i]
ar.sort()
for i in range(n - 1, -1, -1):
	if count >= s:
		ar1.append(ar[i])
		s = s + ar[i]
		count = count - ar[i]
print(len(ar1))


from sys import stdin, stdout
inp = stdin.readline()
coins = [int(i) for i in stdin.readline().split()]
sum1 = 0
num_coins = 0
while sum1 <= sum(coins):
	sum1 += max(coins)
	coins.remove(max(coins))
	num_coins += 1
stdout.write(str(num_coins))


n = int(input())
nums = [int(x) for x in input().split()]
nums.sort()
sum1 = 0
counter = 1
for i in range(n):
	sum1 += nums[n - 1 - i]
	if sum1 > sum(nums[:n - 1 - i]):
		counter += i
		break
print(counter)


n = int(input())
c = sorted(list(map(int, input().split(' '))), reverse=True)
(s, sc) = (0, 0)
for i in c:
	s += i
	sc += 1
	c[c.index(i)] = 0
	if s > sum(c):
		break
print(sc)


n = int(input())
lst = list(map(int, input().split()))
lst = sorted(lst)
count = 0
add = 0
total = sum(lst)
for coins in reversed(lst):
	add += coins
	count += 1
	total -= coins
	if add > total:
		break
print(count)


a = int(input())
b = [int(i) for i in input().split()]
b = sorted(b)
b = b[::-1]
c = sum(b)
f = 0
c = c // 2
e = 0
for i in range(a):
	if e <= c:
		e += b[i]
		f += 1
print(f)


__author__ = 'Aleksey'
input()
str1 = input().split()
coins = list(map(int, str1))
coins.sort(reverse=True)
for i in range(len(coins) + 1):
	if sum(coins[:i]) > sum(coins[i:]):
		print(i)
		break


n = int(input())
g = []
k = []
for i in range(n):
	a = map(int, input().split())
	g += a
	break
g.sort()
g.append(0)
for u in g:
	if sum(k) <= sum(g):
		k.append(max(g))
		g.remove(k[-1])
	elif sum(k) > sum(g):
		break
print(len(k))


import sys
import math
import itertools
from sys import stdin, stdout
from functools import lru_cache
import statistics
import datetime
import collections
M_PI = 3.141592653589793
sys.setrecursionlimit(5000)
CACHE_MAX_SIZE = 5000

def problemA():
	n = intput()
	for i in range(n):
		m = intput()
		coins = intlist()
		S = sum(coins)
		pos = get_all_subsums(coins, S // 2)
		i = S // 2
		while i != 0:
			if i in pos:
				break
			i -= 1
		print(S - 2 * i)

def get_all_subsums(elems: [int], target=-1, maxi=-1) -> {int}:
	if target != -1 and maxi == -1:
		maxi = target
	elif maxi == -1:
		maxi = sum(elems)
	pos = set()
	for e in elems:
		if e > maxi:
			continue
		if target in pos:
			break
		tmp = pos.copy()
		pos.add(e)
		for a in tmp:
			if a + e <= maxi:
				pos.add(a + e)
			if a + e == target:
				break
	return pos

def problemB():
	n = intput()
	arr = intlist()
	arr.sort(reverse=True)
	S = sum(arr)
	P = 0
	for i in range(n):
		P += arr[i]
		S -= arr[i]
		if P > S:
			break
	print(i + 1)

def main():
	problemB()

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

def floatput():
	return float(stdin.readline())

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

def floatlist():
	return list(map(float, stdin.readline().split()))

class Point:

	def __init__(self, x=0, y=0, z=0):
		(self.x, self.y, self.z) = (x, y, z)

	def __add__(self, point):
		return Point(self.x + point.x, self.y + point.y, self.z + point.z)

	def __sub__(self, point):
		return Point(self.x + point.x, self.y + point.y, self.z + point.z)

	def __mul__(self, alpha: float):
		return Point(self.x * alpha, self.y * alpha, self.z * alpha)

	def __truediv__(self, alpha: float):
		return Point(self.x / alpha, self.y / alpha, self.z / alpha)

	def __eq__(self, point):
		return self.x == point.x and self.y == point.y and (self.z == point.z)

	def __ne__(self, point):
		return not self.__eq__(point)

	@staticmethod
	def distance(p1, p2):
		return math.sqrt((p1.x - p2.x) ** 2 + (p1.y - p2.y) ** 2 + (p1.z - p2.z) ** 2)

	@staticmethod
	def manhattan_distance(p1, p2):
		return abs(p1.x - p2.x) + abs(p1.y - p2.y) + abs(p1.z - p2.z)

def isBissextile(year: int) -> bool:
	return not year % 400 or (year % 100 and (not year % 4))

def getCombinations(my_list):
	combinations = []
	for L in range(0, len(my_list) + 1):
		for subset in itertools.combinations(my_list, L):
			combinations.append(subset)
	return combinations

def is_palindromic(value: str) -> bool:
	return str(value) == str(value)[::-1]

def factorial(n: int) -> int:
	f = 1
	for i in range(2, n + 1):
		f *= i
	return f

def numberToBase(n: int, base: int) -> [int]:
	if n == 0:
		return [0]
	digits = []
	while n:
		digits.append(int(n % base))
		n //= base
	return digits[::-1]

def toRoman(nb: int) -> str:
	tab = ['I', 'V', 'X', 'L', 'C', 'D', 'M']
	power = 0
	answer = ''
	while nb != 0:
		num = nb % 10
		nb //= 10
		if num == 0:
			pass
		elif num == 1:
			answer = tab[power] + answer
		elif num == 2:
			answer = tab[power] + tab[power] + answer
		elif num == 3:
			answer = tab[power] + tab[power] + tab[power] + answer
		elif num == 4:
			answer = tab[power] + tab[power + 1] + answer
		elif num == 5:
			answer = tab[power + 1] + answer
		elif num == 6:
			answer = tab[power + 1] + tab[power] + answer
		elif num == 7:
			answer = tab[power + 1] + tab[power] + tab[power] + answer
		elif num == 8:
			answer = tab[power + 1] + tab[power] + tab[power] + tab[power] + answer
		elif num == 9:
			answer = tab[power] + tab[power + 2] + answer
		power += 2
	return answer

def corde():
	N = int(input())
	tab = map(int, list(input().split()))
	d = {i + 1: val for (i, val) in enumerate(tab)}
	for i in range(2, N + 1):
		for j in range(1, i):
			d[i] = max(d[i], d[j] + d[i - j])
	print(d[N])

def LIS(X):
	M = [-1] * (len(X) + 1)
	P = [-1] * len(X)
	L = 0
	for i in range(len(X)):
		deb = 1
		fin = L
		while deb <= fin:
			mid = math.ceil((1.0 * deb + fin) / 2)
			if X[M[mid]] < X[i]:
				deb = mid + 1
			else:
				fin = mid - 1
		newL = deb
		P[i] = M[newL - 1]
		M[newL] = i
		if newL > L:
			L = newL
	S = [-1] * L
	index = M[L]
	for i in reversed(range(0, L)):
		S[i] = X[index]
		index = P[index]
	return L

def knapsack0(capacity, items):
	dp = [False] * (capacity + 1)
	dp[0] = True
	for i in range(1, capacity + 1):
		j = 0
		while j < len(items) and (not dp[i]):
			if i - items[j] >= 0 and dp[i - items[j]]:
				dp[i] = True
			j += 1
	answer = capacity
	while not dp[answer]:
		answer -= 1
	return answer

def knapsack3(W, wt, val, n=-1, init=True):
	if init:
		maxValue = 10000
		maxPieces = len(wt) + 1
		knapsack3.dp = [[-1 for _i in range(maxPieces)] for _j in range(maxValue)]
	if n == -1:
		n = len(wt)
	if knapsack3.dp[W][n] != -1:
		return knapsack3.dp[W][n]
	if n == 0 or W == 0:
		return 0
	if wt[n - 1] > W:
		return knapsack3(W, wt, val, n - 1, False)
	else:
		return max(val[n - 1] + knapsack3(W - wt[n - 1], wt, val, n - 1, False), knapsack3(W, wt, val, n - 1, False))

def minCoinChange(value, pieces, n=-1, init=True):
	if init:
		maxValue = 10000
		maxPieces = len(pieces)
		minCoinChange.dp = [[-1 for i in range(maxPieces)] for j in range(maxValue)]
	if n == -1:
		n = len(pieces) - 1
	if minCoinChange.dp[value][n] != -1:
		return minCoinChange.dp[value][n]
	if n == 0 or value == 0:
		if value % pieces[0] != 0:
			return inf
		else:
			return value // pieces[0]
	elif value < 0:
		return inf
	else:
		minCoinChange.dp[value][n] = min(minCoinChange(value - pieces[n], pieces, n, False) + 1, minCoinChange(value, pieces, n - 1, False))
		return minCoinChange.dp[value][n]

def coinChange(value, pieces, n=-1, init=True):
	if init:
		maxValue = 10000
		maxPieces = len(pieces)
		coinChange.dp = [[-1 for i in range(maxPieces)] for j in range(maxValue)]
	if n == -1:
		n = len(pieces) - 1
	if coinChange.dp[value][n] != -1:
		return coinChange.dp[value][n]
	if n == 0 or value == 0:
		return 1
	elif value < 0:
		return 0
	else:
		coinChange.dp[value][n] = coinChange(value - pieces[n], pieces, n, False) + coinChange(value, pieces, n - 1, False)
		return coinChange.dp[value][n]

def binary_encode(i, num_digits):
	return np.array([i >> d & 1 for d in range(num_digits)])

def generate_primes(n: int) -> [int]:
	if n < 2:
		return []
	is_prime = [False, False] + [True] * (n - 1)
	primes = [2]
	if n >= 3:
		primes.append(3)
	for i in range(5, n + 1, 6):
		if is_prime[i]:
			primes.append(i)
			j = i ** 2
			while j <= n:
				is_prime[j] = False
				j += 2 * i
		if i + 2 <= n and is_prime[i + 2] == True:
			primes.append(i + 2)
			j = (i + 2) ** 2
			while j <= n:
				is_prime[j] = False
				j += 2 * i + 4
	return primes

def knapSack3(Weight, wt, val):

	@lru_cache(maxsize=CACHE_MAX_SIZE)
	def knapsack(W, n):
		if n == 0 or W == 0:
			return 0
		if wt[n - 1] > W:
			return knapsack(W, n - 1)
		else:
			return max(val[n - 1] + knapsack(W - wt[n - 1], n - 1), knapsack(W, n - 1))
	return knapsack(Weight, len(wt))
main()


a = int(input())
b = sorted([int(i) for i in input().split()])
b.reverse()
for i in range(a):
	sum1 = sum(b[:i + 1])
	sum2 = sum(b[i + 1:])
	if sum1 > sum2:
		print(i + 1)
		break


n = int(input())
l = [int(i) for i in input().split()]
l.sort(reverse=True)
c = 0
m = 0
while c <= int(sum(l) / 2):
	c = c + l[m]
	m += 1
print(m)


n = int(input())
a = [int(s) for s in input().split()]
a.sort(reverse=True)
s1 = sum(a)
s = 0
c = 0
for el in a:
	if s + el > s1 // 2:
		s += el
		c += 1
		break
	s += el
	c += 1
print(c)


import sys
monedas = []
total = 0
n = int(sys.stdin.readline())
inputs = sys.stdin.readline().split()
for i in range(len(inputs)):
	moneda = int(inputs[i])
	monedas.append(moneda)
	total += moneda
monedas.sort(reverse=True)
minMonedas = 0
halfTotal = total / 2
for i in range(len(monedas)):
	minMonedas += monedas[i]
	if minMonedas > halfTotal:
		print(i + 1)
		break


num = int(input())
coins = [int(x) for x in input().split()]
sum_coins = sum(coins)
coins = sorted(coins)[::-1]
current_sum = 0
num_coins = 0
for coin in coins:
	num_coins += 1
	if current_sum + coin > sum_coins - (current_sum + coin):
		current_sum += coin
		break
	else:
		current_sum += coin
print(num_coins)


n = int(input())
lo = input()
s = 0
pieces = lo.split()
l = list(map(int, pieces))
for i in range(n):
	s += l[i]
l.sort(reverse=True)
ii = 0
ss = 0
while ii <= n:
	ss += l[ii]
	ii += 1
	if ss > s / 2:
		print(ii)
		quit()


a = int(input())
b = list(map(int, input().split()))
b.sort(reverse=True)
sum1 = b[0]
count = 0
for x in range(1, a + 1):
	if sum1 > sum(b[x:]):
		count += 1
		print(count)
		break
	else:
		sum1 += b[x]
		count += 1


N = int(input())
L = list(map(int, input().split()))
L.sort(reverse=True)
for i in range(1, N):
	if sum(L[:i]) > sum(L[i:]):
		print(i)
		break
else:
	print(N)


a = int(input())
b = []
c = input().split()
for i in c:
	b += [int(i)]
b = sorted(b, reverse=True)
ans = 0
tot = 0
for i in b:
	tot += i
	ans += 1
	if tot > sum(b) / 2:
		break
print(ans)


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
sums = 0
counter = 0
for i in range(len(coins)):
	sums += coins[i]
	counter += 1
	if sums > sum(coins[i + 1:]):
		print(counter)
		break


d = int(input())
nums = [int(num) for num in input().split()]
nums.sort()
count = 0
mine = 0
his = 0
first_i = -1
for i in nums:
	mine += nums[first_i]
	end = len(nums) - abs(first_i)
	his = sum(nums[:end])
	if mine <= his:
		first_i -= 1
		count += 1
		continue
	else:
		count += 1
		break
print(count)


n = int(input())
c = 0
sum = 0
you = 0
he = 0
s = input()
l = s.split()
newl = []
for i in range(n):
	newl.append(int(l[i]))
newl.sort(reverse=True)
for i in newl:
	sum += float(i)
for j in range(n):
	if you <= sum / 2:
		you += float(newl[j])
		c += 1
print(c)


coins_num = int(input())
coins = sorted(list(map(int, input().split())))
total_coins = sum(coins)
my_total = 0
for (j, i) in enumerate(reversed(coins)):
	my_total += i
	total_coins -= i
	if my_total > total_coins:
		print(j + 1)
		exit()


n = int(input())
x = list(map(int, input().split(' ')))
x = sorted(x, reverse=True)
total = sum(x)
sum = int(0)
for i in range(n):
	sum += x[i]
	if sum > total - sum:
		print(i + 1)
		break


x = int(input())
ls = list(map(int, input().split()))[:x]
s = 0
c = 0
ls.sort()
for i in range(1, x + 1):
	s = s + ls[-1]
	ls.remove(ls[-1])
	c = c + 1
	if s > sum(ls):
		break
print(c)


n = int(input())
var = input()
var = list(map(int, var.split()))
var.sort(reverse=True)
suma = 0
for i in range(len(var)):
	suma += var[i]
suma_partiala = 0
i = 0
while i < len(var) and suma_partiala <= suma:
	suma_partiala += var[i]
	suma -= var[i]
	i += 1
print(i)


(n, a, c, o, i) = (int(input()), sorted(list(map(int, input().split()))), 0, 0, 0)
a.reverse()
while c <= o:
	c += a[i]
	i += 1
	o = 0
	for j in range(i, len(a)):
		o += a[j]
print(i)


n = int(input())
k = list(map(int, input().split()))
money = []
while sum(k) >= sum(money):
	money.append(max(k))
	k.pop(k.index(max(k)))
print(len(money))


import sys
n = int(input())
b = list(map(int, input().split()))
a = sorted(b, reverse=True)
s = 0
p = 0
k = 1
c = 0
if n == 1:
	print('1')
	sys.exit()
if n == 2 and a[0] == a[1]:
	print('2')
	sys.exit()
if n == 2 and a[0] != a[1]:
	print('1')
	sys.exit()
for i in range(0, n):
	s = s + a[i]
for i in range(0, n - 1):
	for k in range(i, i + 1):
		p = p + a[k]
		c = c + 1
		if p > s - p:
			print(c)
			sys.exit()


def main():
	input()
	coinstr = input().split()
	coins = sorted([int(x) for x in coinstr], reverse=True)
	final = 0
	value = 0
	for i in coins:
		value += i
		final += 1
		if sum(coins) - value >= value:
			continue
		else:
			break
	print(final)
main()


n = int(input())
s = 0
summ = 0
m = input().split(' ')
m = list(map(int, m))
m.sort(reverse=True)
for i in range(n):
	s += m[i]
	mid = int(s / 2)
coin_index = 0
while summ <= mid:
	summ += m[coin_index]
	coin_index += 1
print(coin_index)


n = int(input())
li = [int(x) for x in input().split()]
li.sort(reverse=True)
i = 1
while sum(li[:i]) <= sum(li[i:]):
	i += 1
print(i)


n = int(input())
coins = sorted(list(map(int, input().split())))
sum_coins = sum(coins) / 2
our_share = 0
num_coins = 0
while len(coins) > 0 and our_share <= sum_coins:
	our_share += coins.pop(-1)
	num_coins += 1
print(num_coins)


n = int(input())
a = sorted(list(map(int, input().strip().split())))
c = 0
x = 0
sum = 0
for item in a:
	sum += item
while c <= sum:
	x += 1
	h = a[n - 1]
	n -= 1
	a.remove(h)
	c += h
	sum -= h
print(x)


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


y = input()
x = input().split()
g = [int(i) for i in x]
g.sort()
o = 0
for i in range(1, len(g) + 1):
	if sum(g[-i:]) > sum(g) // 2:
		o = i
		print(o)
		break


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
lsum = 0
rsum = sum(a)
c = 0
for i in range(len(a)):
	if lsum <= rsum:
		lsum += a[i]
		rsum -= a[i]
		c += 1
	else:
		break
print(c)


from collections import defaultdict as dd

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

def inin():
	return int(input())

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

def ar(element, size):
	return [element for i in range(size)]

def digitsum(num):
	su = 0
	while num:
		su += num % 10
		num //= 10
	return su

def yes():
	print('YES')

def no():
	print('NO')

def countDivisibles(A, B, M):
	if A % M == 0:
		return B // M - A // M + 1
	return B // M - A // M

def countSetBits(n):
	count = 0
	while n:
		count += n & 1
		n >>= 1
	return count
Testcase = 1
for _ in range(Testcase):
	n = inin()
	arr = inar()
	arr.sort(reverse=True)
	ss = sum(arr)
	ihave = 0
	index = 0
	while index < n and ihave <= ss:
		ihave += arr[index]
		ss -= arr[index]
		index += 1
	print(index)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()

def steal(n, arr):
	l = len(arr)
	if l == 1:
		return 1
	sum = 0
	for i in arr:
		sum += i
	q = n - 1
	c = 0
	while True:
		if c > sum:
			break
		c += arr[q]
		sum -= arr[q]
		q -= 1
	return n - q - 1
print(steal(n, arr))


n = int(input())
val = 0
l = list(map(int, input().split()))
for i in range(n):
	val = val + l[i]
l.sort()
g = l[-1]
cnt = 1
for j in range(1, n):
	if val - g < g:
		break
	else:
		g = g + l[n - j - 1]
		cnt = cnt + 1
print(cnt)


def bigMoney():
	a = int(input())
	money = list(map(int, input().split()))
	money.sort(reverse=True)
	sumMoney = sum(money)
	myMoney = 0
	cnt = 0
	for i in money:
		if sumMoney / 2 >= myMoney and a / 2 >= cnt:
			cnt += 1
			myMoney += i
	print(cnt)
bigMoney()


def listsum(numList):
	theSum = 0
	for i in numList:
		theSum = theSum + i
	return theSum
n = int(input())
count = 0
money = [int(i) for i in input().split()]
sum = 0
while sum <= listsum(money):
	sum += max(money)
	money.remove(max(money))
	count += 1
print(count)


def main():
	n = int(input())
	(res, partialsum, target) = (0,) * 3
	coins = list(map(int, input().split()))
	coins.sort()
	while coins:
		res += 1
		target += coins.pop()
		while partialsum < target and coins:
			partialsum += coins.pop(0)
	if partialsum >= target:
		print(res + 1)
	else:
		print(res)
main()


n = int(input())
l = list(map(int, input().split()))
s = sum(l)
l.sort(reverse=True)
x = []
sc = sum(x)
i = 0
while i < n and sc <= s - sc:
	x.append(l[i])
	i = i + 1
	sc = sum(x)
print(len(x))


b = int(input())
a = list((int(x) for x in input().split()))
a.sort()
a.reverse()
(coins, sum1, sum2) = (0, 0, sum(a))
for i in a:
	sum1 += i
	sum2 -= i
	coins += 1
	if sum1 > sum2:
		print(coins)
		break


def main():
	from sys import stdin, stdout
	n = int(stdin.readline())
	l = sorted(list(map(int, stdin.readline().split())))
	p = l[-1]
	lsum = sum(l[:-1])
	l = l[:-1]
	count = 1
	while lsum >= p:
		p += l[-1]
		lsum -= l[-1]
		l = l[:-1]
		count += 1
	stdout.write(str(count))
main()


n = int(input())
a1 = [int(i) for i in input().split()]
a = 0
s1 = sum(a1)
s2 = 0
count = 0
if len(a1) == n:
	a1 = sorted(a1)
	a1.reverse()
	for i in a1:
		s2 = s2 + i
		s1 = s1 - i
		count = count + 1
		if s2 > s1:
			break
	print(count)
else:
	print('worng input format')


n = int(input())
mine = 0
k = 0
coins = list(map(int, input().split()))
coins.sort(reverse=True)
coinssum = sum(coins)
for i in range(n):
	if mine > coinssum:
		break
	mine += coins[i]
	coinssum -= coins[i]
	k += 1
print(k)


a = int(input())
c = list(map(int, input().split()))
c.sort(reverse=True)
x = sum(c)
y = x // 2 + 1
s = 0
count = 0
for i in c:
	s = s + i
	count += 1
	if s >= y:
		break
print(count)


import sys
import math
n = int(sys.stdin.readline().rstrip())
coin_values = [int(value) for value in sys.stdin.readline().rstrip().split()]
coin_values.sort(reverse=True)
target = math.ceil(sum(coin_values) / 2.0)
if sum(coin_values) % 2 == 0:
	target += 1
num_coins = 0
cur_sum = 0
for coin_value in coin_values:
	if cur_sum < target:
		num_coins += 1
		cur_sum += coin_value
	else:
		break
print(num_coins)


n = int(input())
s = list(map(int, input().split(' ')))
sum = 0
counter = 0
moidengi = 0
check = 0
for i in range(n):
	sum += s[i]
while sum // 2 >= moidengi:
	max = 0
	for i in range(n):
		if s[i] > max:
			max = s[i]
			check = i
	moidengi += max
	s[check] = 0
	counter += 1
print(counter)


input()
coins = list(map(int, input().split()))
coins.sort()
our_total = sum(coins)
mine_total = 0
mine_number = 0
while mine_total <= our_total:
	coin = coins.pop()
	our_total -= coin
	mine_total += coin
	mine_number += 1
print(mine_number)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
k = sum(a)
for i in range(n):
	j = sum(a[:i + 1])
	if j > k - j:
		print(i + 1)
		break


num = int(input())
ar = input().split()
k = 0
arr = []
for h in ar:
	f = int(h)
	arr.append(f)
arr.sort()
sum_arr = sum(arr)
arr.reverse()
sum1 = 0
i = 0
while sum1 <= sum_arr / 2:
	sum1 += arr[i]
	i += 1
print(i)


n = int(input())
l1 = [int(i) for i in input().split()]
l1.sort()
c = 0
s = 0
for i in range(len(l1) - 1, -1, -1):
	if s <= sum(l1[0:i + 1]):
		s = s + l1[i]
		c += 1
	else:
		break
print(c)


n = int(input())
coins = list(map(int, input().split()))
coins.sort()
tot = sum(coins)
div = tot / 2
took = 0
for i in range(len(coins)):
	took = took + coins[-1 - i]
	if took > div:
		n = i + 1
		break
print(n)


a = int(input())
b = list(map(int, input().split(' ')))
b.sort(reverse=True)
bsum = sum(b)
sum = 0
count = 0
for i in b:
	if sum <= bsum / 2:
		count = count + 1
		sum = sum + i
	else:
		break
print(count)


s = int(input())
num = [int(x) for x in input().split()]
num.sort(reverse=True)
t = sum(num)
p = 0
for i in range(s):
	p += int(num[i])
	if p > t / 2:
		print(i + 1)
		break


def twin(line1, line2):
	coins = [int(num) for num in line2.split(' ')]
	ourCoins = 0
	ourCoinsCount = 0
	twinsCoins = sum(coins)
	while ourCoins <= twinsCoins and len(coins) > 0:
		largestCoin = max(coins)
		ourCoins += largestCoin
		twinsCoins -= largestCoin
		coins.remove(largestCoin)
		ourCoinsCount += 1
	print(ourCoinsCount)
twin(input(), input())


n = int(input())
s = sorted([int(i) for i in input().split()], reverse=True)
p = sum((i for i in s)) / 2
su = 0
count = 0
for i in range(n):
	if su > p:
		break
	else:
		su += s[i]
		count += 1
print(count)


input()
ns = sorted([int(x) for x in input().split()], reverse=True)
s = sum(ns)
t = 0
c = 0
for n in ns:
	if t > s - t:
		break
	t += n
	c += 1
print(c)


x = int(input())
y = list(map(int, input().split()))
y.sort()
z = sum(y)
c = 0
m = 0
for n in range(x - 1, -1, -1):
	m = m + y[n]
	c = c + 1
	r = z - m
	if m > r:
		break
	elif m <= r:
		c = c
print(c)


inp = input()
s = [int(i) for i in input().split(' ')]
s.sort(reverse=True)
sum = 0
for q in s:
	sum += q
sumtry = 0
t = 0
while sumtry <= sum / 2:
	sumtry += s[t]
	t += 1
print(t)


n = int(input())
a = list(map(int, input().split()))
x = sum(a)
a.sort(reverse=True)
s = 0
y = 0
for i in a:
	x = x - i
	y += i
	s += 1
	if y > x:
		break
	else:
		continue
print(s)


x = int(input())
y = list(map(int, input().split()))
count = 0
tsum = 0
total = sum(y)
y.sort(reverse=True)
for n in y:
	count = count + 1
	tsum += n
	if tsum > total / 2:
		break
print(count)


n = input()
nums = [int(num) for num in input().rstrip().split(' ')]
total = sum(nums)
taken = 0
ans = 0
nums.sort(reverse=True)
for num in nums:
	taken += num
	ans += 1
	if taken > total - taken:
		break
print(ans)


in0 = int(input())
in1 = [int(x) for x in input().split()]
in1.sort(reverse=True)
(sumc, out0) = (0, 0)
for x in range(in0):
	if sum(in1) / 2 >= sumc:
		sumc += in1[x]
		out0 += 1
	else:
		break
print(out0)


n = int(input())
a = []
s = 0
c = []
w = input().split(' ')
for i in range(n):
	b = int(w[i])
	a.append(b)
a.sort()
a.reverse()
for i in range(n):
	s = a[i] + s
	s2 = 0
	for j in range(i + 1, n):
		s2 = a[j] + s2
	if s > s2:
		c.append(i + 1)
print(c[0])


def fun():
	numb = input()
	n = numb[0]
	data = input()
	vec = []
	sum = 0
	data = data.split(' ')
	for i in data:
		vec.append(int(i))
		sum += int(i)
	vec.sort()
	res = 0
	cur = 0
	for i in reversed(vec):
		cur = cur + i
		if cur > sum - cur:
			res += 1
			break
		else:
			res += 1
	print(res)
fun()


c = 0
count = 0
i = input()
k = list(map(int, input().split()))
k.sort()
for i in range(len(k), 0, -1):
	c += 1
	count += k[i - 1]
	if count > sum(k) - count:
		print(c)
		break


n = int(input())
x = list(map(int, input().split()))
x.sort(reverse=True)
s = sum(x)
k = 0
c = 0
while s >= k:
	s = s - x[c]
	k = k + x[c]
	c = c + 1
print(c)


N = int(input())
a = list(map(int, input().split()))

def mini(arr, n):
	hs = 0
	for i in range(n):
		hs = hs + arr[i]
	hs = int(hs / 2)
	arr.sort(reverse=True)
	res = 0
	cs = 0
	for i in range(n):
		cs += arr[i]
		res += 1
		if cs > hs:
			return res
	return res
print(mini(a, N))


a = int(input())
b = input().split()
lst = []
for m in b:
	lst.append(int(m))
c = sorted(lst)
d = c.reverse()
q = 0
k = 0
p = 0
for i in b:
	q = q + int(i)
h = q // 2 + 1
for j in c:
	p = p + int(j)
	k = k + 1
	if p >= h:
		break
print(k)


n = int(input())
string = input()
l = string.split()
x = 0
for i in range(n):
	l[i] = int(l[i])
l.sort(reverse=True)
if n == 1:
	coins = 1
else:
	for i in range(n):
		x += l[i]
		y = 0
		coins = 0
		coins = i + 1
		for j in range(i + 1, n):
			y += l[j]
		if x > y:
			break
print(coins)


value = int(input())
numbers = input()
numbers = numbers.split()
numbers = [int(i) for i in numbers]
numbers.sort(reverse=True)
count = list()
while sum(count) <= sum(numbers):
	count.append(numbers[0])
	numbers.remove(numbers[0])
print(len(count))


cnt = int(input())
L = [int(x) for x in input().split(' ')]
sum = 0
temp = 0
for i in range(0, cnt):
	sum += L[i]
L.sort(reverse=True)
average = sum / 2
for i in range(0, cnt):
	temp += L[i]
	if temp > average:
		print(i + 1)
		break


import operator as op
import functools as ft
n = int(input())
A = list(map(int, input().split()))
su = ft.reduce(op.add, A)
A = sorted(A, reverse=True)
cu = 0
for i in range(n):
	cu = cu + A[i]
	if cu * 2 > su:
		print(i + 1)
		break


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
a.reverse()
s1 = s2 = 0
for x in a:
	s1 += x
for i in range(0, len(a)):
	s2 += a[i]
	if 2 * s2 > s1:
		print(i + 1)
		exit(0)


coin = int(input())
value = [int(x) for x in input().split()]
value.sort(reverse=True)
out = 0
sum0 = 0
for i in range(len(value)):
	sum0 += value[i]
	sum1 = 0
	for j in range(i + 1, len(value)):
		sum1 += value[j]
	if sum1 < sum0:
		out = i + 1
		break
print(out)


n = int(input())
arr = list(map(int, input().split()))
count = 0
arr.sort()
for i in range(len(arr) - 1, 0, -1):
	if sum(arr[i:]) > sum(arr[:i]):
		count = i
		break
print(len(arr) - count)


n = int(input())
coins = [int(element) for element in input().split(' ')]
coins.sort(reverse=True)
total = sum(coins)
subtotal = coin_count = 0
for value in coins:
	subtotal += value
	coin_count += 1
	if subtotal > total - subtotal:
		print(coin_count)
		break


try:
	for i in range(int(input())):
		ar = list(map(int, input().split()))
		c = 0
		k = 0
		ar1 = sorted(ar)
		ar2 = ar1[::-1]
		for j in range(len(ar2)):
			k += ar2[j]
			c += 1
			if k > sum(ar2[j + 1:]):
				break
		print(c)
		break
except:
	pass


n = int(input())
coins = [int(x) for x in input().split()]
coins = list(reversed(sorted(coins)))
goal = (sum(coins) + 2) // 2
totaltaken = 0
numbertaken = 0
while totaltaken < goal:
	m = coins.pop(0)
	totaltaken += m
	numbertaken += 1
print(numbertaken)


N = int(input())
ls = list(map(int, input().strip().split()))
ls.sort()
ls.reverse()
total = sum(ls)
bound = total // 2
coins = 0
value = 0
while value <= bound:
	coins += 1
	value += ls[0]
	del ls[0]
print(coins)


n = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
S = sum(coins)
k = 0
for i in range(n):
	k += coins[i]
	if k > S / 2:
		print(i + 1)
		break


line1 = int(input())
line2 = [int(x) for x in input().split(' ')]
needed = sum(line2) / 2
line2.sort()
max = 0
for i in range(1, line1 + 1):
	max += line2[-i]
	if max > needed:
		print(i)
		break


input()
coins = list(map(int, input().split()))
coins.sort(reverse=True)
our_total = sum(coins)
mine_total = 0
mine_number = 0
for coin in coins:
	mine_total += coin
	mine_number += 1
	our_total -= coin
	if mine_total > our_total:
		break
print(mine_number)


x = int(input())
q = 0
w = 0
coins = 0
s = input().split()
a = [int(num) for num in s]
for i in a:
	q += i
while q >= w * 2:
	d = max(a)
	w += d
	a.remove(d)
	coins += 1
print(coins)


input()
input = list(map(int, input().split()))
input.sort(reverse=True)
sum = sum(input)
curr_sum = 0
curr_i = -1
while curr_sum <= sum - curr_sum and curr_i + 1 != len(input):
	curr_i += 1
	curr_sum += input[curr_i]
print(curr_i + 1)


N = int(input())
A = list(map(int, input().split()))
len_A = len(A)
A.sort()
total = sum(A)
my_total = 0
count = 0
for i in range(len_A - 1, -1, -1):
	my_total += A[i]
	count += 1
	if my_total > total - my_total:
		break
print(count)


a = input()
k = input().split()
k = [int(i) for i in k]
sum_k = sum(k) // 2
k.sort(reverse=True)
(act_c, count) = (0, 0)
for i in k:
	if act_c <= sum_k:
		act_c += i
		count += 1
	else:
		break
print(count)


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


n = int(input())
ar = [int(x) for x in input().split()]
ar.sort()
s = 0
s1 = 0
for i in range(n):
	s += ar[i]
for i in range(n - 1, -1, -1):
	s1 += ar[i]
	if s1 > abs(s - s1):
		print(n - i)
		break


n = input()
coins = input().split()
for i in range(0, int(n)):
	coins[i] = int(coins[i])
coins.sort()
summ = 0
check = 0
c = 0
for i in range(0, int(n)):
	summ = summ + int(coins[i])
for i in range(0, int(n)):
	check = check + int(coins[int(n) - i - 1])
	c = c + 1
	if check > summ - check:
		print(c)
		exit()


n = int(input())
coin = list(reversed(sorted(map(int, input().split()))))
counter = 0
tmp = 0
Sum = sum(coin)
for i in coin:
	tmp += i
	counter += 1
	if tmp > Sum / 2:
		break
print(counter)


N = int(input())
a = list(map(int, input().split()))
a.sort()
s = sum(a) // 2
x = 0
count = 0
for i in range(len(a) - 1, -1, -1):
	if x <= s:
		x += a[i]
		count += 1
	else:
		break
print(count)


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


n = int(input())
l = sorted(map(int, input().split()))
m = 0
for i in range(n):
	m = m + l[i]
j = 1
s = 0
while s <= m / 2:
	s += l[-j]
	j += 1
print(j - 1)


n = int(input())
arr = list(map(int, input().split()))
sum = 0
for i in arr:
	sum = sum + i
x = sum / 2
arr.sort(reverse=True)
sum = 0
count = 0
for i in arr:
	sum = sum + i
	if sum <= x:
		count = count + 1
print(count + 1)


t = int(input())
A = list(map(int, input().split(' ')))
A.sort()
for i in range(t):
	ls2 = []
	ls = []
	for x in range(t - i - 1, t):
		ls2.append(int(A[x]))
	s1 = sum(ls2)
	for j in range(t - i - 1):
		ls.append(int(A[j]))
	s2 = sum(ls)
	if s1 > s2:
		t1 = i + 1
		print(t1)
		break


numberOfCoins = int(input())
coins = input().split(' ')
coinsArr = []
valueSumTotal = 0
valueSum = 0
contCoins = 0
for i in coins:
	valueSumTotal = valueSumTotal + int(i)
	coinsArr.append(int(i))
coinsArr.sort()
coinsArr = coinsArr[::-1]
for i in range(0, numberOfCoins):
	valueSum = valueSum + coinsArr[i]
	valueLeft = valueSumTotal - valueSum
	contCoins += 1
	if valueSum > valueLeft:
		print(contCoins)
		break


a = int(input())
l = list(map(int, input().split()))
l.sort()
l.reverse()
k = []
for i in range(len(l)):
	k = l[0:i + 1]
	t = l[i + 1:len(l)]
	if sum(k) > sum(t):
		print(len(k))
		exit()
print(1)


n = int(input())
coin = sorted(list(map(int, input().split())))
q1 = sum(coin[:n - 1])
q2 = sum(coin[n - 1:])
for i in range(n):
	if q1 < q2:
		print(len(coin[n - 1 - i:]))
		break
	else:
		q2 += coin[n - 2 - i]
		q1 -= coin[n - 2 - i]


n = int(input())
a = [int(x) for x in input().split(' ')]
sum = sum(a)
a.sort(reverse=True)
t = 0
ans = 0
for i in a:
	t += i
	ans += 1
	if t > sum // 2:
		break
print(ans)


n = int(input())
m = list(map(int, input().split()))
m.sort()
s = set(m)
x = 0
count = 0
total_money = sum(m)
while x <= total_money / 2:
	x += m.pop()
	count += 1
print(count)


x = int(input())
y = input().split()
h = 0
lst = []
for h in range(x):
	lst.append(int(y[h]))
	h += 1
lst.sort(reverse=True)
z = 0
yJ = 0
yJlh = 0
yJlh2 = 0
i = 0
if x == 1:
	z = 1
elif x == 2:
	if int(lst[0]) > int(lst[1]):
		z = 1
	else:
		z = 2
elif x > 2:
	while i < x - 1:
		i += 1
		yJ += int(lst[i])
	if int(lst[0]) > yJ:
		z = 1
	elif int(lst[0]) == yJ:
		z = 2
	elif int(lst[0]) < yJ:
		for j in range(x - 1):
			yJlh += int(lst[j])
			j += 1
			k = j
			while k < x:
				yJlh2 += int(lst[k])
				k += 1
			if yJlh > yJlh2:
				z = j
				break
			yJlh2 = 0
print(z)


a = int(input())
b = list(map(int, input().split()))
b.sort()
c = b[::-1]
s = sum(b)
cunt = 0
l = []
k = s
for i in range(a):
	k = k - c[i]
	l.append(c[i])
	if k < sum(l):
		break
	else:
		continue
print(len(l))


n = int(input())
x = input()
values = []
for i in range(n):
	values.append(int(x.split()[i]))
values.sort()
values = values[::-1]
total = 0
count = 0
while total <= sum(values):
	total += values[0]
	count += 1
	values = values[1:]
print(count)


N = int(input())
a = [int(x) for x in input().split()]
a.sort()
total = sum(a)
idx = len(a) - 1
partial_sum = 0
count = 0
while partial_sum * 2 <= total:
	partial_sum += a[idx]
	idx -= 1
	count += 1
print(count)


n = int(input())
l = list(map(int, input().strip().split(' ')))
nbr = 0
l.sort()
s = sum(l)
mine = 0
while mine <= s - mine:
	mine += l.pop()
	nbr += 1
print(nbr)


n = int(input())
a = [int(x) for x in input().split(' ')]
a = sorted(a)
a.reverse()
s = sum(a)
m = 0
k = 0
for i in range(0, n):
	m += a[i]
	k += 1
	if m > s - m:
		break
print(k)


w = input()
k = list(map(int, input().split()))
k.sort()
ee = 0
i = 0
while ee <= sum(k) - ee:
	ee += k[-i - 1]
	i += 1
print(i)


n = int(input())
coins = list(map(int, input().split()))
total = sum(coins)
coins = sorted(coins, reverse=True)
present = 0
for i in range(len(coins)):
	present += coins[i]
	if present > total // 2:
		break
print(i + 1)


n = int(input())
a = list(map(int, input().split()))
x = []
j = len(a)
for i in range(j):
	if sum(x) <= sum(a):
		x.append(max(a))
		a.remove(max(a))
print(len(x))


from __future__ import division, print_function

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

def get_array():
	return list(map(int, input().strip().split()))
mod = 1000000007
from collections import defaultdict

def main():
	n = int(input())
	arr = get_array()
	cnt = mod
	if n == 2:
		if all((arr[0] == i for i in arr)):
			print(2)
		else:
			print(1)
	elif n == 1:
		print(1)
	else:
		arr.sort(reverse=True)
		for i in range(n):
			if sum(arr[:i]) > sum(arr[i:]):
				cnt = min(cnt, i)
		print(cnt)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			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 = list(map(int, input().split()))
x = sorted(l)
x = x[::-1]
s = 0
l = []
i = 0
while s <= sum(x) / 2:
	s += x[i]
	l.append(x[i])
	i += 1
print(len(l))


n = int(input())
lst = list(map(int, input().split()))
lst.sort()
lst.reverse()
count = 0
money = 0
for i in lst:
	if money <= sum(lst) - money:
		money += i
		count += 1
	else:
		break
print(count)


int(input())
coins = list(map(int, input().split()))
s = sum(coins) // 2
n = 0
a = 0
while n <= s:
	n += max(coins)
	coins.remove(max(coins))
	a += 1
print(a)


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


def main():
	n = input()
	coins = sorted(map(int, input().split()), reverse=True)
	sumCoins = sum(coins)
	for i in range(len(coins)):
		if sum(coins[0:i + 1]) > sumCoins / 2:
			print(i + 1)
			return
	print(len(coins))
main()


import sys
from math import ceil, log, gcd, sqrt
RI = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('Yes')

def NO():
	print('No')
INF = 10 ** 18
MOD = 10 ** 9 + 7
n = int(ri())
a = RI()
a.sort(reverse=True)
summ = sum(a)
cur = 0
ite = 0
for i in a:
	ite += 1
	cur = cur + i
	summ = summ - i
	if cur > summ:
		break
print(ite)


n = int(input())
n = [int(i) for i in input().split()]
n = sorted(n)
SUM = 0
i = 0
while SUM <= sum(n) // 2:
	SUM += n[-1 - i]
	i += 1
print(i)


from sys import *
input = stdin.readline
n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
s = sum(l)
x = 0
for i in range(n):
	s -= l[i]
	x += l[i]
	if x > s:
		print(i + 1)
		break


def sol(n, a):
	a.sort()
	tot = sum(a)
	sub = 0
	i = n - 1
	while i >= 0:
		sub += a[i]
		if sub * 2 > tot:
			return n - i
		i -= 1
	assert False
	return -1
n = int(input())
a = list(map(int, input().strip().split()))
print(sol(n, a))


import sys
n = int(input())
l = list(map(int, input().split()))
ct = 0
l.sort(reverse=True)
if n == 1:
	print(1)
	sys.exit()
for i in range(n - 1):
	ct += 1
	s1 = sum(l[:i + 1])
	s2 = sum(l[i + 1:])
	if s1 > s2:
		print(ct)
		break
	elif s1 == s2:
		print(ct + 1)
		break


import math
t = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
res = 0
ans = 1
for i in range(t):
	res = res + a[i]
	if res <= sum(a) - res:
		ans += 1
print(ans)


numCoins = int(input())
coins = list(map(int, input().split(' ')))
sortedCoins = sorted(coins, reverse=True)
totalSum = sum(coins)
mySum = 0
for (i, coin) in enumerate(sortedCoins):
	mySum += coin
	if mySum > totalSum - mySum:
		print(i + 1)
		break


n = int(input())
values = sorted(map(int, input().split()), reverse=True)
total = sum(values)
count = 0
current = 0
for v in values:
	current += v
	count += 1
	if current > total - current:
		break
print(count)


n = int(input())
a = list(map(int, input().split()))
a = list(reversed(sorted(a)))
s = sum(a)
ss = 0
for i in range(n):
	ss += a[i]
	if 2 * ss > s:
		print(i + 1)
		break
else:
	print(n)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
count1 = 0
count2 = sum(a)
ind = 0
while count1 <= count2:
	count1 += a[ind]
	count2 -= a[ind]
	ind += 1
print(ind)


o = int(input())
max = input(' ').split(' ')
m = list(map(int, max))
m.sort(reverse=True)
k = sum(m)
d = 0
for i in range(len(m)):
	if k >= d:
		k = k - m[i]
		d = d + m[i]
		if k == 0:
			print(i + 1)
	else:
		print(i)
		break


n = int(input())
a = list(map(int, input().split()))
a.sort()
s = 0
for k in range(n):
	s = s + a[k]
d = s / 2
a.reverse()
su = 0
for i in range(n):
	if su <= d:
		su = su + a[i]
		c = i
print(c + 1)


n = int(input())
a = list(map(int, input().split(maxsplit=n - 1)))
my_monets = 0
bosm = 0
my_count_money = 0
while my_monets <= bosm:
	my_monets += max(a)
	a.remove(max(a))
	bosm = sum(a)
	my_count_money += 1
print(my_count_money)


n = input()
arr = list(map(int, input().split()))
arr.sort()
arr.reverse()

def res(arr):
	for i in range(len(arr)):
		if sum(arr[:i]) > sum(arr[i:]):
			return len(arr[:i])
	return len(arr)
print(res(arr))


cnt = int(input())
mon = list(map(int, input().split(' ')))
my = list()

def summa(val):
	res = 0
	for i in val:
		res += i
	return res
flag = False
while not flag:
	my.append(max(mon))
	mon.remove(max(mon))
	if summa(my) > summa(mon):
		flag = True
print(len(my))


n = int(input().strip())
a = [int(i) for i in input().strip().split()]
a.sort(reverse=True)
csum = 0
total = sum(a)
for i in range(len(a) + 1):
	if 2 * csum > total:
		print(i)
		break
	else:
		csum = csum + a[i]


n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
avg = sum(a) / 2
mins = []
if a[0] > avg:
	print(1)
else:
	for i in range(1, n, 1):
		j = i
		total = a[0]
		coins = 1
		while total <= avg and j < n:
			total += a[j]
			j += 1
			coins += 1
		if total > avg:
			mins.append(coins)
	print(min(mins))


m = int(input())
nom = []
ans = []
nom = map(int, input().split())
nom = list(nom)
nnn = []
for i in range(len(nom)):
	nnn.append(nom[i])
for j in nnn:
	ans.append(max(nom))
	nom.remove(max(nom))
	if sum(ans) > sum(nom):
		print(len(ans))
		break


from sys import stdin
n = int(stdin.readline())
arr = sorted(map(int, stdin.readline().split()))
s = sum((x for x in arr))
m = s / 2
count = 0
d = 0
for i in range(n - 1, -1, -1):
	d += arr[i]
	count += 1
	if d > m:
		break
print(count)


def func(arr, k):
	arr = sorted(arr)
	tmp = 0
	summa = sum(arr)
	i = k - 1
	counter = 0
	while tmp <= summa and i >= 0:
		counter += 1
		tmp += arr[i]
		summa -= arr[i]
		i -= 1
	print(counter)

def main():
	k = int(input())
	cash = list(map(int, input().split()))
	func(cash, k)
main()


n = int(input())
a = list(map(int, input().split()))
sum1 = 0
sum2 = sum(a)
a.sort(reverse=True)
i = 0
while sum1 <= sum2 and i < n:
	sum1 += a[i]
	sum2 -= a[i]
	i += 1
print(i)


a = int(input())
c = [int(x) for x in input().split()]
d = sum(c)
c.sort()
e = 0
o = 0
for i in range(a):
	n = -i - 1
	e += c[n]
	o += 1
	if e > d / 2:
		print(o)
		break


b = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse=True)
s = sum(a)
f = []
for i in range(len(a)):
	f.append(a[i])
	t = sum(f)
	if t > s - t:
		print(len(f))
		break
	else:
		pass


import math
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
sum1 = a[0]
sum2 = sum(a)
count = 1
for i in range(1, n):
	if sum1 <= sum2 // 2:
		sum1 += a[i]
		count += 1
	else:
		break
print(count)


from math import *
a = int(input())
b = list(map(int, input().split()))
b.sort(reverse=True)
t = 0
for p in range(a):
	t += b[p]
flag = 0
count = 0
for c in range(a):
	flag += b[c]
	count += 1
	if flag > floor(t / 2):
		break
	else:
		continue
print(count)


number = int(input())
coin_list = list(map(int, input().split()))
coin_sum = sum(coin_list)
coin_list.sort()
(count, current) = (0, 0)
while current <= coin_sum:
	current += coin_list[-1]
	coin_sum -= coin_list[-1]
	del coin_list[-1]
	count += 1
print(count)


n = int(input())
lists = [int(i) for i in input().split(' ')]
lists.sort(reverse=True)
if n == 1:
	print(1)
else:
	for i in range(n):
		sumLower = 0
		sumUpper = 0
		for j in range(i + 1):
			sumLower += lists[j]
		for j in range(i + 1, n):
			sumUpper += lists[j]
		if sumLower > sumUpper:
			print(i + 1)
			break


n = int(input())
num = [int(x) for x in input().split()]
num.sort(reverse=True)
sum = 0
for i in range(0, n):
	sum += num[i]
sum //= 2
cnt = 0
xsum = 0
for i in range(0, n):
	cnt += 1
	xsum += num[i]
	if xsum > sum:
		break
print(cnt)


from collections import defaultdict

def main():
	n = int(input())
	dados = sorted(map(int, input().split()))
	soma = 0
	total = sum(dados)
	for i in range(len(dados) - 1, -1, -1):
		soma += dados[i]
		if 2 * soma > total:
			print(len(dados) - i, end='')
			exit()
main()


n = int(input(''))
coins = input('')
coinlist = coins.split(' ')
s = 0
c = 0
cl = []
ans = []
if n == len(coinlist):
	for coin in coinlist:
		cl.append(int(coin))
		scl = sum(cl)
	cl.sort(reverse=True)
	for coin in cl:
		s += coin
		scl -= coin
		c += 1
		if s > scl:
			ans.append(c)
print(ans[0])


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


coins_count = input()
coins = list(map(int, input().split()))
coins.sort(reverse=True)
total_val = sum(coins)
coins_to_take = 0
current_sum = 0
for x in coins:
	if current_sum <= total_val - current_sum:
		coins_to_take += 1
		current_sum += x
print(coins_to_take)


import math
n = int(input())
arr = sorted(list(map(int, input().split())))
sum_ = sum(arr) // 2
count = 1
total = 0
for i in range(n):
	count = i
	total += arr[n - 1 - i]
	if total > sum_:
		break
print(count + 1)


import math
n = input('')
vals = list(map(int, input('').split()))
vals.sort(reverse=True)
total_sum = sum(vals)
min_sum = 0
i = 0
while min_sum <= math.floor(total_sum / 2) and i < len(vals):
	min_sum += vals[i]
	i += 1
print(i)


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

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())
	f = list(map(int, input().split()))
	f.sort()
	f.reverse()
	s = sum(f) // 2
	z = 0
	for i in range(0, n):
		z += f[i]
		if z > s:
			print(i + 1)
			return
	print(0)

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


def twins():
	int(input())
	l = list(map(int, input().strip().split()))
	s1 = sum(l)
	s2 = 0
	c = 0
	l.sort(reverse=True)
	for e in l:
		s2 += e
		s1 -= e
		c += 1
		if s2 > s1:
			return c
print(twins())


sum1 = 0
sum2 = 0
n = input()
arr = input().split(' ')
l = [int(num) for num in arr]
l.sort(reverse=True)
sum2 = sum(l)
i = 0
count = 0
while sum1 <= sum2 and i < len(l):
	sum1 = sum1 + l[i]
	sum2 = sum2 - l[i]
	i = i + 1
	count = count + 1
print(count)


num_coins = int(input())
coins = list(map(int, input().split(' ')))
res = 0
my_sum = 0
remaining_sum = sum(coins)
coins.sort(reverse=True)
for c in coins:
	res += 1
	my_sum += c
	remaining_sum -= c
	if my_sum > remaining_sum:
		break
print(res)


numberOfCoins = int(input())
coinValues = [int(c) for c in input().split()]
coinsNeeded = 1
coinValues.sort(reverse=True)
while sum(coinValues[0:coinsNeeded]) <= sum(coinValues[coinsNeeded:]):
	coinsNeeded += 1
print(coinsNeeded)


import queue
__read_tokens = queue.Queue()

def next_string():
	while __read_tokens.empty():
		for i in input().split():
			__read_tokens.put(i)
	return __read_tokens.get()

def next_int():
	return int(next_string())

def next_float():
	return float(next_string())

def next_line():
	if not __read_tokens.empty():
		raise Exception('Unclean token cache')
	return input()

def sort_minus(a, n):
	m = n - 1
	while m > 0:
		for i in range(m):
			if a[i] < a[i + 1]:
				x = a[i]
				a[i] = a[i + 1]
				a[i + 1] = x
		m = m - 1
	return a

def summa(a, n):
	s = 0
	for i in range(n):
		s = s + a[i]
	return s
n = next_int()
s = list(map(int, input().split()))
s = sort_minus(s, n)
sum = summa(s, n)
k = 0
i = 0
while k <= sum // 2:
	k = k + s[i]
	i = i + 1
print(i)


n = int(input())
coins = sorted([int(i) for i in input().split()], reverse=True)
total = sum(coins) / 2
m = 0
for i in range(n):
	m += coins[i]
	if m > total:
		print(i + 1)
		break


def merge_sort(collection):
	length = len(collection)
	if length > 1:
		midpoint = length // 2
		left_half = merge_sort(collection[:midpoint])
		right_half = merge_sort(collection[midpoint:])
		i = 0
		j = 0
		k = 0
		left_length = len(left_half)
		right_length = len(right_half)
		while i < left_length and j < right_length:
			if left_half[i] > right_half[j]:
				collection[k] = left_half[i]
				i += 1
			else:
				collection[k] = right_half[j]
				j += 1
			k += 1
		while i < left_length:
			collection[k] = left_half[i]
			i += 1
			k += 1
		while j < right_length:
			collection[k] = right_half[j]
			j += 1
			k += 1
	return collection
n = input()
coins = merge_sort([int(x) for x in input().split()])
twins_sum = sum(coins)
my_sum = 0
i = 0
while twins_sum >= my_sum:
	coin = coins[i]
	my_sum += coin
	twins_sum -= coin
	i += 1
print(i)


num_coins = int(input())
coins = list(map(int, input().split()))
coins.sort(reverse=True)
sum_value = sum(coins)
(tracker_sum, n) = (0, 0)
for coin in coins:
	tracker_sum += coin
	n += 1
	if tracker_sum > sum_value - tracker_sum:
		break
print(n)


N = int(input())
A = [int(i) for i in input().split()]
A = sorted(A, reverse=True)
s = sum(A)
res = 0
for i in range(N):
	res += A[i]
	if res > s // 2:
		print(i + 1)
		break


n = int(input())
m = sorted(list(map(int, input().split())), reverse=True)
s = sum(m)
c = 0
c_sum = 0
for i in m:
	if c_sum > s:
		break
	c_sum += i
	s -= i
	c += 1
print(c)


n = int(input())
List = input().split()
for i in range(len(List)):
	List[i] = int(List[i])
total = sum(List)
List.sort()
num = 0
total2 = 0
for i in range(len(List) - 1, -1, -1):
	num += 1
	total2 += List[i]
	if total2 > total / 2:
		print(num)
		break


n = int(input())
l = list(map(int, input().split()))
v = sum(l) / 2
l.sort()
l.reverse()
p = 0
for i in range(n):
	p += l[i]
	if p > v:
		print(i + 1)
		break


n = int(input())
a = sorted([int(x) for x in input().split()])[::-1]
coins = 0
sofar = 0
while sofar <= sum(a):
	coins += 1
	sofar += a.pop(0)
print(coins)


n = int(input())
coins = [int(i) for i in input().split(' ')]
half = sum(coins) / 2
coins.sort(reverse=True)
num = 0
total = 0
for c in coins:
	if total <= half:
		num += 1
		total += c
print(num)


n = int(input())
p = input().split()
p = list(map(int, p))
p = sorted(p)
s = sum(p)
ss = 0
i = len(p) - 1
while i >= 0:
	ss = ss + p[i]
	s = s - p[i]
	if ss > s:
		break
	i = i - 1
print(len(p) - i)


numCoins = int(input())
coins = [int(n) for n in input().split()]
coins.sort(reverse=True)
counter = 0
total = sum(coins)
keep = 0
for coin in coins:
	keep += coin
	counter += 1
	if keep > total - keep:
		break
print(counter)


n = int(input())
l = [int(k) for k in input().split(' ')]

def qs(t, l, r):
	if l < r:
		p = div(t, l, r)
		qs(t, l, p - 1)
		qs(t, p + 1, r)

def div(t, l, r):
	piv = t[r]
	i = l - 1
	for j in range(l, r):
		if t[j] < piv:
			i += 1
			swap(t, i, j)
	swap(t, i + 1, r)
	return i + 1

def swap(t, l, r):
	v = t[l]
	t[l] = t[r]
	t[r] = v
qs(l, 0, n - 1)
sums = [0]
for k in l:
	sums.append(sums[-1] + k)
s = sums[-1]
(l, r) = (n // 2, n)
while l < r:
	i = (l + r) // 2
	if sums[i] >= s / 2:
		r = i
	else:
		l = i + 1
i = (l + r) // 2
print(n + 1 - i)


a = int(input())
b = [int(x) for x in input().split()]
count = 0
n = 0
bsort = sorted(b, reverse=True)
sum1 = sum(b)
half = sum1 / 2
if bsort == [0]:
	print(count)
else:
	for i in bsort:
		count = count + 1
		n = n + i
		if n > half:
			break
	print(count)


coin_count = int(input())
coin_price = list(map(int, input().split()))
coin_price.sort()
total_twin_price = sum(coin_price)
amout_stole = 0
for i in range(1, coin_count + 1):
	amout_stole += coin_price[-i]
	total_twin_price -= coin_price[-i]
	if amout_stole > total_twin_price:
		print(i)
		break


n = int(input())
a = list(map(int, input().split()))
a.sort()
a1 = 1
if len(a) == 2:
	if a[0] == a[1]:
		a1 = 2
elif len(a) == 1:
	if a[0] == 0:
		a1 = 0
else:
	a2 = -1
	aku = sum(a[a2:len(a)])
	dia = sum(a[0:a2])
	while aku <= dia:
		a2 -= 1
		aku = sum(a[a2:len(a)])
		dia = sum(a[0:a2])
		a1 += 1
print(a1)


x = int(input())
value = list(map(int, input().split()))
value.sort(reverse=True)
total = sum(value)
my_coins = 0
total_coins = 0
for a in value:
	var = total - my_coins
	if my_coins <= var:
		my_coins += a
		total_coins += 1
	else:
		break
print(total_coins)


from math import ceil
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
s = sum(a)
x = 0
k = 0
for i in range(n - 1, -1, -1):
	x = x + a[i]
	k = k + 1
	if x > s / 2:
		break
print(k)


n = int(input())
c = list(map(int, input().split()))
c.sort()
i = len(c)
while i > 0:
	if sum(c[i:]) > sum(c[:i]):
		break
	else:
		i -= 1
print(len(c) - i)


input()
arr = list(reversed(sorted(list(map(int, input().split())))))
s = sum(arr)
taken = 0
for (i, e) in enumerate(arr):
	taken += e
	if taken > s // 2:
		print(i + 1)
		exit()


n = int(input())
l = sorted(map(int, input().split()), reverse=True)
q = 0
a = 0
for i in range(n):
	q = l[i] + q
	a = a + 1
	if q > sum(l) / 2:
		break
print(a)


n = int(input())
a = list(map(int, input().split()))
half = sum(a) / 2
a.sort(reverse=True)
number = 0
mine = 0
for i in a:
	mine += i
	number += 1
	if mine > half:
		break
print(number)


n1 = int(input())
b = list(map(int, input().strip().split()))[:n1]
b.sort()
c = 1
x = b.pop()
while 1:
	if x > sum(b):
		print(c)
		break
	else:
		c = c + 1
		x = x + b.pop()


count = input()
data = list(map(int, input().split()))
data.sort(reverse=True)
sum_coin = 0
count_coin = 0
for coin in data:
	if sum_coin <= sum(data) / 2:
		sum_coin += coin
		count_coin += 1
	else:
		break
print(count_coin)


n = int(input())
lis = []
count = 0
total = 0
[lis.append(int(x)) for x in input().split()]
lis.sort(reverse=True)
num = sum(lis) // 2
for i in lis:
	if total <= num:
		total += i
		count += 1
print(count)


n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
for i in range(1, n + 1):
	li = l[:i]
	lp = l[i:]
	if sum(li) > sum(lp):
		print(i)
		exit()


n = int(input())
nums = list(map(int, input().split()))
max_list = []
maximum = nums.pop(nums.index(max(nums)))
max_list.append(maximum)
while sum(max_list) <= sum(nums):
	maximum = nums.pop(nums.index(max(nums)))
	max_list.append(maximum)
print(len(max_list))


n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
e = sum(a) / 2
s = []
for i in a:
	s = s + [i]
	if sum(s) > e:
		break
print(len(s))


nlist = int(input())
nums = list(map(int, input().split(' ')))
nums.sort(reverse=True)
tot = sum(nums)
maj = 0
count = 0
for no in nums:
	maj += no
	count += 1
	if maj > tot / 2:
		break
print(count)


n = int(input())
x = 0
c = input().split()
for i in range(0, len(c)):
	c[i] = int(c[i])
c.sort(reverse=True)
s = sum(c)
tot = c[0]
while tot <= s / 2:
	x += 1
	if x == n:
		break
	tot += c[x]
print(x + 1)


n = int(input())
p = [0] * (n + 1)
m = list(map(int, input().split()))
m.sort(reverse=True)
m.insert(0, 0)
for i in range(1, n + 1):
	p[i] = p[i - 1] + m[i]
for i in range(1, n + 1):
	if p[i] > p[n] / 2:
		print(i)
		break


import sys, os.path
import math
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
sum_1 = sum(l)
count = 0
sum_2 = 0
for i in range(n):
	if sum_2 > sum_1:
		break
	else:
		sum_1 -= l[i]
		sum_2 += l[i]
		count += 1
print(count)


n = int(input())
list1 = list(map(int, input().split()))
list1.sort(reverse=True)
tsum = 0
sum2 = 0
count = 0
for x in range(n):
	tsum += list1[x]
for x in range(n):
	count += 1
	sum2 += list1[x]
	tsum -= list1[x]
	if sum2 > tsum:
		break
print(count)


import math
scanner = lambda : map(int, input().split())
n = int(input())
s = sorted(list(scanner()))[::-1]
for i in range(1, n + 1):
	if sum(s[:i]) > sum(s[i:]):
		print(i)
		break


n = int(input())
l = list(map(int, input().split()))
total = sum(l)
l.sort(reverse=True)
win = 0
for j in range(n):
	you = l[:j + 1]
	val = sum(you)
	twin = total - val
	if val > twin:
		print(j + 1)
		win = 1
		break