n = int(eval(input()))

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



A.sort()

from itertools import accumulate

C = [0]+A

C = list(accumulate(C))



def is_ok(x):

    if x == n-1:

        return True

    y = C[x+1]

    flag = True

    for i in range(x+1, n):

        if A[i] > 2*y:

            flag = False

        y += A[i]

    if flag:

        return True

    else:

        return False



if is_ok(0):

    print(n)

    exit()



l = 0

r = n-1

while l+1 < r:

    c = (l+r)//2

    if is_ok(c):

        r = c

    else:

        l = c

print((n-r))

n = int(eval(input()))

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

A.sort()

from itertools import accumulate

C = [0]+A

C = list(accumulate(C))



def is_ok(x):

    if x < 0:

        return False

    cur = C[x+1]

    for i in range(x+1, n):

        if A[i] <= 2*cur:

            cur += A[i]

        else:

            break

    else:

        return True

    return False



ng = -1

ok = n-1

while ng+1 < ok:

    c = (ok+ng)//2

    if is_ok(c):

        ok = c

    else:

        ng = c



ans = n-ok

print(ans)
n = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
from itertools import accumulate

C = [0] + A
C = list(accumulate(C))


def is_ok(x):
    if x == n - 1:
        return True
    y = C[x + 1]
    flag = True
    for i in range(x + 1, n):
        if A[i] > 2 * y:
            flag = False
        y += A[i]
    if flag:
        return True
    else:
        return False


if is_ok(0):
    print(n)
    exit()
l = 0
r = n - 1
while l + 1 < r:
    c = (l + r) // 2
    if is_ok(c):
        r = c
    else:
        l = c
print((n - r))

n = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
from itertools import accumulate

C = [0] + A
C = list(accumulate(C))


def is_ok(x):
    if x < 0:
        return False
    cur = C[x + 1]
    for i in range(x + 1, n):
        if A[i] <= 2 * cur:
            cur += A[i]
        else:
            break
    else:
        return True
    return False


ng = -1
ok = n - 1
while ng + 1 < ok:
    c = (ok + ng) // 2
    if is_ok(c):
        ok = c
    else:
        ng = c
ans = n - ok
print(ans)

-    if x == n - 1: +    if x < 0: +        return False +    cur = C[x + 1] +    for i in range(x + 1, n): +        if A[i] <= 2 * cur: +            cur += A[i] +        else: +            break +    else: -    y = C[x + 1] -    flag = True -    for i in range(x + 1, n): -        if A[i] > 2 * y: -            flag = False -        y += A[i] -    if flag: -        return True -    else: -        return False +    return False -if is_ok(0): -    print(n) -    exit() -l = 0 -r = n - 1 -while l + 1 < r: -    c = (l + r) // 2 +ng = -1 +ok = n - 1 +while ng + 1 < ok: +    c = (ok + ng) // 2 -        r = c +        ok = c -        l = c -print((n - r)) +        ng = c +ans = n - ok +print(ans)