Problem:
 Score : 400 points    Problem Statement Snuke found N strange creatures.
Each creature has a fixed color and size. The color and size of the i -th creature are represented by i and A_i , respectively.  Every creature can absorb another creature whose size is at most twice the size of itself.
When a creature of size A and color B absorbs another creature of size C and color D ( C \leq 2 \times A ), they will merge into one creature of size A+C and color B .
Here, depending on the sizes of two creatures, it is possible that both of them can absorb the other.  Snuke has been watching these creatures merge over and over and ultimately become one creature.
Find the number of the possible colors of this creature.      Constraints  2 \leq N \leq 100000  1 \leq A_i \leq 10^9  A_i is an integer.         Input The input is given from Standard Input in the following format:  N  A_1  A_2 … A_N       Output Print the number of the possible colors of the last remaining creature after the N creatures repeatedly merge and ultimately become one creature.        Sample Input 1 3
3 1 4      Sample Output 1 2  The possible colors of the last remaining creature are colors 1 and 3 .
For example, when the creature of color 3 absorbs the creature of color 2 , then the creature of color 1 absorbs the creature of color 3 , the color of the last remaining creature will be color 1 .       Sample Input 2 5
1 1 1 1 1      Sample Output 2 5  There may be multiple creatures of the same size.       Sample Input 3 6
40 1 30 2 7 20      Sample Output 3 4

Solution (Python):

import bisect
import math

N = int(input())

A = list(map(int,input().split()))
A.sort()
A_ = sorted(A)
ans = 0
for i in range(N-1):
    A_[i+1] += A_[i]


t=0
for i in range(N-1):
    
    if A_[i]*2 >= A[i+1]:
        ans += 1
    else:
        ans = 0
ans += 1
print(ans)

Solution (Python):

import bisect
import math

N = int(input())

A = list(map(int,input().split()))
A.sort()
A_ = sorted(A)
ans = 0
for i in range(N-1):
    A_[i+1] += A_[i]


for i in range(N-1):
    
    if A_[i]*2 >= A[i+1]:
        ans += 1
    else:
        ans = 0
ans += 1
print(ans)

Solution (Python):
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

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

    S = A[0]
    ans = 1
    for a in A[1:]:
        if S * 2 < a:
            ans = 0
        S += a
        ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

A.sort()
tmp = A[0]
ans = 1
for i in range(1, N):
  if tmp*2 >= A[i]:
    tmp += A[i]
    ans += 1
  else:
    tmp += A[i]
    ans = 1
print(ans)

Solution (Python):
n=int(input())
a=[0]+sorted(list(map(int,input().split())))
for i in range(n):
  if 2*a[i]<a[i+1]:flag=0
  else:flag=1
  a[i+1]+=a[i]
  a[i]*=flag
ans=0
for i in a[::-1]:
  if i:ans+=1
  else:break
print(ans)

Solution (Python):
n, *A = map(int, open(0).read().split())
A.sort()
s = 0
for a in A:
  if 2*s < a:
    c = 1
  else:
    c += 1
  s += a
print(c)

Solution (Python):
N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)

sam = sum(A)
ans = 1
for i in range(0, N):
    sam -= A[i]
    if sam*2 >= A[i]:
        ans += 1
    else:
        break

print(ans)

Solution (Python):
import numpy as np
N = int(input())
x = list(map(int,input().split()))
x.sort()
x_cm = np.cumsum(x)[::-1]
x = x[::-1]
count = 1
for i in range(N-1):
    if x[i]<=x_cm[i+1]*2:
        count += 1
    else:
        break

print(count)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 9)

def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')







def solve():
    N = II()
    A = LI()
    A.sort()

    sm = 0
    j = -1
    for i, a in enumerate(A[:-1]):
        sm += a
        
        if 2 * sm >= A[i+1]:
            pass
        else:
            j = i
    
    print(N - (j + 1))

if __name__ == '__main__':
    solve()

Solution (Python):
from itertools import accumulate

def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    CUSUM = tuple(accumulate(A))

    sub = 0
    for i in range(N-1):
        if CUSUM[i]*2 < A[i+1]:
            sub = i+1
    print(N-sub)
    
if __name__ == "__main__":
    main()

Solution (Python):
import sys
input = sys.stdin.readline

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

cnt = 1
for i in range(N-1):
    if A[i]*2 < A[i+1]:
        cnt = 1
    else:
        cnt += 1
    A[i+1] += A[i]

print(cnt)

Solution (Python):
def main():
    import sys

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

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

    
if __name__ == '__main__':
    main()

Solution (Python):
import numpy as np

N = int(input())
A = list(map(int, input().split()))
a = sorted(A)
res = list(np.cumsum(a))

ans = 0
idx = 1
for i in range(len(res)):
    num = res[i]
    if(idx <= i):
        idx = i+1
    while(num*2 >= a[idx]):
        num += a[idx]
        idx += 1
        
        if(idx >= len(res)-1):
            break
       
    if(idx >= len(res)-1):
        print(N-i)
        break

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
a.sort()

for i in range(1,N):
    a[i] = a[i-1] + a[i]
cnt = 1
for i in reversed(range(1,N)):
    if(a[i] > a[i-1] * 3): 
        break
    cnt += 1
print(cnt)

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    A = LI()
    A.sort()

    
    
    A_cum = [0] * (N + 1)
    for i in range(N):
        A_cum[i+1] = A_cum[i] + A[i]

    l = [A_cum[i] * 2 >= A[i] for i in range(1, N)]
    l.reverse()
    if False in l:
        print(l.index(False) + 1)
    else:
        print(N)

if __name__ == '__main__':
    resolve()

Solution (Python):
n=int(input())
a = sorted( list(map(int,input().split())) )
b=[0]*n
b[0]=a[0]
for i in range(n-1):b[i+1]=b[i]+a[i+1]
chk2 = [1 if b[i]*2>=a[i+1] else 0 for i in range(n-1)]
ans=0
while ans<n-1:
    if chk2[n-2-ans]==0:break
    ans+=1
print(ans+1)

Solution (Python):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
from math import sqrt
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7





"""
6
40 1 30 2 7 20
"""

N = getN()
A = getList()
A.sort()
imos = copy.deepcopy(A)
for i in range(N - 1):
    imos[i + 1] += imos[i]


streak = [0] * N
streak[-1] = 1
for i in range(N - 1):
    if imos[i] * 2 >= A[i + 1]:
        streak[i] = 1

ans = 0
for i in range(N - 1, -1, -1):
    if streak[i] == 1:
        ans += 1
    else:
        break
print(ans)

Solution (Python):

def solve():
    n = int(input())
    a = [int(x) for x in input().split()]
    a.sort()
    
    sm = 0
    ans = 0
    for i in range(n-1):
        sm += a[i]
        if sm * 2 >= a[i+1]:
            ans += 1
        else:
            ans = 0
    print(ans+ 1)

solve()

"""
5 6
4 7 9 3 4
"""

Solution (Python):
from itertools import accumulate

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

a.sort()

b = list(accumulate(a))

point = 0

for i in range(n-1):
    if b[i]*2 >= a[i+1]:
        point += 1
    else:
        point = 0

print(point+1)

Solution (Python):
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())
a=lnii()
a.sort()

sum_v=0
ans=0
for i in range(n-1):
  sum_v+=a[i]
  if sum_v*2>=a[i+1]:
    ans+=1
  else:
    ans=0

ans+=1
print(ans)

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = [0]+list(mapint())
As.sort()
from itertools import accumulate
cAs = list(accumulate(As))
cAs.sort(reverse=True)
As.sort(reverse=True)

ans = 1
for i in range(1, N):
    if cAs[i]*2<As[i-1]:
        break
    ans += 1

print(ans)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = 1
now = A[0]
for i in range(1,N):
  if A[i] <= 2*now:
    now += A[i]
    ans += 1
  else:
    now += A[i]
    ans = 1
print(ans)

Solution (Python):
N = int(input())
A = sorted(list(map(int,input().split())))
B = [0 for _ in range(N+1)]
for i in range(1,N+1):
    B[i] = B[i-1]+A[i-1]
cnt = 1
for i in range(N-2,-1,-1):
    if A[i+1]<=2*B[i+1]:
        cnt += 1
    else:
        break
print(cnt)

Solution (Python):
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())
a=lnii()
a.sort()

b=[0]
for i in range(1,n+1):
  b.append(b[i-1]+a[i-1])
b=b[1:]

ans=1
for i in range(n-2,-1,-1):
  if b[i]*2>=a[i+1]:
    ans+=1
  else:
    break

print(ans)

Solution (Python):
n,*a=map(int,open(0).read().split())
a.sort()
v=t=0
for i in range(1,n):v+=a[i-1];t=[t,i][2*v<a[i]]
print(n-t)

Solution (Python):
n,*a=map(int,open(0).read().split())
a.sort()
v=t=0
for i in range(1,n):
 v+=a[i-1]
 if 2*v<a[i]:t=i
print(n-t)

Solution (Python):
from itertools import*
n,*a=map(int,open(t:=0).read().split())
a.sort()
*b,=accumulate(a)
for i in range(1,n):
 if 2*b[i-1]<a[i]:t=i
print(n-t)

Solution (Python):
from itertools import*
n, *a = map(int, open(t := 0).read().split())
a.sort()
*b, = accumulate(a)
for i in range(1, n):
  if 2 * b[i - 1] < a[i]:t = i
print(n - t)

Solution (Python):
n=int(input())
a=list(map(int, input().split()))
a.sort()
acc=0
cnt=1
for i in range(n-1):
    acc+=a[i]
    if 2*acc<a[i+1]:
        cnt=1
    else:
        cnt+=1
    
print(cnt)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A.sort()

S = [0]*(N+1)
for i in range(1, N+1):
    S[i] = S[i-1] + A[i-1]

for i in range(N)[::-1]:
    if S[i]*2 < A[i]:
        print(N-i)
        exit()

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

Solution (Python):
n = int(input())
A = map(int, input().split())

s = sorted(A)

ac = 0
startI = 0
for i, a in enumerate(s):
    if i == len(s) - 1:
        print(len(s) - startI)
        exit()

    ac += a

    if ac * 2 < s[i+1]:
        startI = i+1

Solution (Python):
def solve(n, a):
    a = sorted(a)
    total = 0
    optimal = 0
    for i in range(n-1):
        total += a[i]
        if total * 2 < a[i+1]:
            optimal = i+1
    return n - optimal

n = int(input())
a = list(map(int, input().split()))
print(solve(n, a))

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)

import itertools
Ruisekiwa = list(itertools.accumulate(A))

count = 1

Dekiru = [0]*N
Dekiru[N-1] = 1

for i in range (1, N):
	if 2*Ruisekiwa[N-i-1] >= A[N-i] and Dekiru[N-i] == 1:
		count+=1
		Dekiru[N-i-1]=1
        
print(count)

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
A.sort()

total = 0
count = 1
for i in range(1, n):
  if 2 * (A[i - 1] + total) >= A[i]:
    count += 1
  else:
    count = 1
  total += A[i - 1]
print(count)

Solution (Python):
import bisect
n=int(input())
a=list(map(int,input().split()))
a.sort()

x=bisect.bisect_left(a,a[-1]/2)

ans=n-x
if x==0:
    print(ans)
    exit()
i=x-1
j=x
tmp=a[i]
ref=a[x]
SUM=sum(a[:i+1])

for k in range(i,-1,-1):
    if k==i:
        if 2*SUM>=a[k+1]:
            ans+=1
        else:
            break
    else:
        SUM-=a[k+1]
        
        if 2*SUM>=a[k+1]:
            ans+=1
        else:
            break
print(ans)

Solution (Python):
N = int(input())
A = sorted(map(int, input().split()))
M = max(A)
cs = [0]
for i in A:
    cs.append(cs[-1] + i)
A.append(A[-1])
ans = 0
for i in range(N, 0, -1):
    if cs[i] * 2 >= A[i]:
        ans += 1
    else:
        break
print(ans)

Solution (Python):
import bisect

N = int(input())
A = sorted(map(int, input().split()))
M = max(A)
cs = [0] 
for i in A:
    cs.append(cs[-1] + i)
A.append(A[-1])
ans = 0
for i in range(N, 0, -1):
    if cs[i] * 2 >= A[i]:
        ans += 1
    else:
        break
print(ans)

Solution (Python):
import sys
from itertools import accumulate

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')


def resolve():
    n = int(input())
    A = sorted(list(map(int, input().split())))

    R = [0] + list(accumulate(A))
    left = 0
    for i in range(n):
        if R[i] * 2 < A[i]:
            left = i
    print(n - left)


if __name__ == '__main__':
    resolve()

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

import numpy as np

A = sorted(A)
B = np.cumsum(A)

mem = N
for i in range(N-1):
    if 2*B[i] >= A[i+1]:
        mem = min(i, mem)
    else:
        mem = N
print(N-mem)

Solution (Python):
import math
import collections
import itertools
import heapq

def main():
    N = int(input())
    A = list(map(int, input().split()))

    revs_A = sorted(A, reverse=True)
    double_A = sorted(list(map(lambda x: 2*x, A)))
    cum_double_A = list(itertools.accumulate(double_A))[::-1]
    res = 1
    for i, a in enumerate(cum_double_A[1:]):
        if a >= revs_A[i]:
            res += 1
        else:
            break
    print(res)

if __name__ == "__main__":
    main()

Solution (Python):
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
a = sorted(LIST())

s = 0
ans = n
for i in range(n-1):
    s += a[i]
    if s * 2 < a[i+1]:
        ans = n - (i + 1)
print(ans)

Solution (Python):





import math
import fractions
import sys
import bisect
import heapq  
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr



def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod



def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


inf = 10 ** 18
mod = 10 ** 9 + 7

n = ir()
a = lr()
a.sort()
a1 = [0]
for num in a:
    a1.append(a1[-1]+num)
def sumArea(l,r):
    return a1[r]-a1[l]
ans = 1
for i in range(1,n):
    if a[n-i] > 2*sumArea(0,n-i):
        break
    else:
        ans+=1
print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

A.sort()
stop = N
for i in reversed(range(N-1)):
    if A[i]* 2 < A[i+1]:
        if 2 * sum(A[:i+1]) < A[i+1]:
            stop = i
            break

print(len(A[stop+1:]) if stop != N else N)

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

Solution (Python):
import math
from bisect import *
n=int(input())
a=sorted(list(map(int,input().split())))
tmp=a[0]
ans=1
aa=1
for i in range(1,n):
    if tmp*2>=a[i]:
        tmp+=a[i]
        ans+=1
    else:
        tmp+=a[i]
        ans=1
print(ans)

Solution (Python):
n, *aa = map(int, open(0).read().split())

aa.sort()

count = 1
tmp = aa[0]
for i in range(1,n):
    if 2 * tmp >= aa[i]:
        tmp += aa[i]
        count += 1
    else:
        tmp += aa[i]
        count = 1


print(count)

Solution (Python):
n = int(input())
A = sorted(list(map(int, input().split())))

from itertools import accumulate

ans = 1
cumsum = list(reversed(list(accumulate(A))))

for a,cs in zip(reversed(A), cumsum[1:]):
    if a <= 2*cs:
        ans += 1
    else:
        break
print(ans)

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from itertools import accumulate
    n = int(readline())
    a = list(map(int, readline().split()))
    a.sort()
    acc = list(accumulate(a))

    ok = n - 1
    ng = -1

    while abs(ng - ok) > 1:
        mid = (ok + ng) // 2
        i = mid
        cur = acc[i]
        while i < n - 1:
            if 2 * cur >= a[i + 1]:
                cur += a[i + 1]
                i += 1
            else:
                break
        if i == n - 1:
            ok = mid
        else:
            ng = mid

    print(n - ok)


if __name__ == '__main__':
    main()

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    N = in_n()
    A = sorted(in_nl())

    asum = [0] * (N + 1)
    for i in range(N):
        asum[i + 1] = asum[i] + A[i]

    ans = 1
    for i in range(N - 1, -1, -1):
        if A[i] <= asum[i] * 2:
            ans += 1
        else:
            break

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7


N = INT()
A = LIST()

A.sort()

cnt = 0
tmp = 0
for i in range(N-1):
	tmp += A[i]
	if A[i+1] <= 2*tmp:
		cnt += 1
	else:
		cnt = 0

cnt += 1

print(cnt)

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
A.sort()
sA = [0]
for i in range(n):
    sA.append(sA[i]+A[i])

A = A[::-1]
sA = sA[::-1]
ans = 1
for i in range(1,n):
    if 2*sA[i]>=A[i-1]:
        ans += 1
    else:
        break
print(ans)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a.sort()
temp=[a[0]]
for i in range(n-1): temp.append(temp[i]+a[i+1])
a.sort(reverse=True)
temp.reverse()
flag=1
for i in range(n-1):
    if a[i]>2*a[i+1] and a[i]>2*temp[i+1]:
        flag=0
        print(i+1)
        break
if flag: print(n)

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = list(map(int, input().split()))
a.sort()
def sub(x):
    v = a[x]
    for i,num in enumerate(a):
        if i==x:
            continue
        if v*2>=num:
            v += num
        else:
            ans = False
            break
    else:
        ans = True
    return ans
if sub(0):
    ans = n
elif not sub(n-1):
    ans = 0
else:
    l = 0
    r = n
    while l<r-1:
        m = (l+r)//2
        if sub(m):
            r = m
        else:
            l = m
    ans = n-r
print(ans)

Solution (Python):
import copy
n=int(input())
a=list(map(int,input().split()))
a.sort()
c=i=st=0

while i <n-1:
  
  if 2*(a[st]+c) >= a[i+1]:
    c+=a[i+1]
    i+=1
    
  else:
    c=a[st]+c
    st=i+1
    i+=1
    
print(n-st)

Solution (Python):
n = int(input())
a = sorted(list(map(int,input().split())))
b = a[:]
for i in range(1,n):
  b[i] = b[i]+b[i-1]

a = a[::-1]
b = b[::-1]

cnt=1
for i in range(1,n):
  if b[i]*2>=a[i-1]:
    cnt+=1
  else:
    break
print(cnt)

Solution (Python):
from itertools import accumulate

n = int(input())
As = list(map(int, input().split()))
As.sort()
acc = [0] + list(accumulate(As))

"""
それまでの累積和が次のやつを食うかどうか
食えない⇨それ以前はいくら頑張ってもダメ
1 2 7 20 30 40
1 3 10 30 60 100 
"""
for i in range(1,n+1):
    if i == 0:continue
    if As[-i] > acc[-i-1]*2:
        break
print(i)

Solution (Python):
n = int(input())
A = list(map(int,input().split()))

A.sort()


ans = 0
size = 0
for i in range(n):
    if A[i] <= 2*size:
        ans += 1
    else:
        ans = 1
    size = A[i] + size

print(ans)

Solution (Python):
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    ret = 1
    cluester_volume = A[0]
    for a in A[1:]:
        if a <= cluester_volume*2:
            ret += 1
        else:
            ret = 1
            
        cluester_volume += a
            
    print(ret)
    
solve()

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a=sorted(a)

import numpy as np
cum=list(np.cumsum(a))

cnt=0
for i in range(n-1,-1,-1):
    if i==n-1:
        cnt+=1
        continue

    if 2*cum[i]>=a[i+1]:
        cnt+=1
    else:
        break

print(cnt)

Solution (Python):
import numpy as np


n = int(input())
a = np.array(list(map(int, input().split())))
a.sort()
a_cum = a.cumsum()
ng = a_cum[:-1] * 2 < a[1:]
ng = np.logical_or.accumulate(ng[::-1])[::-1]
x = (~ng).sum() + 1
print(x)

Solution (Python):
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
a=list(map(int,input().split()))
a.sort()
rui=list(accumulate(a))


cnt=0
now=0
for now in range(n-1):
    if rui[now]*3>=rui[now+1]:
        cnt+=1
    else:
        cnt=0
print(cnt+1)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

A = sorted(A)
A = A + [-1]

ans = 0
total = 0
for i in range(N):
    total += A[i]

    if total >= A[i+1]/2:
        ans += 1
    else:
        ans = 0

print(ans)

Solution (Python):
def main():
    n = int(input())
    A = sorted(list(map(int, input().split())))
    B = [A[0], ]
    s = A[0]
    for a in A[1:]:
        s += a
        B.append(s)
    ans = 1
    for i in range(n - 1, 0, -1):
        if B[i - 1] * 2 >= A[i]:
            ans += 1
        else:
            break
    print(ans)
if __name__ == '__main__':
    main()

Solution (Python):

"""
Created on Fri Jun 26 21:20:10 2020

@author: NEC-PCuser
"""

N = (int(input()))

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

A.sort()

ans = 0
for i in range(0, len(A) - 1):
    if A[i] * 2 >= A[i + 1]:
        ans += 1
    else:
        ans = 0
    A[i + 1] += A[i]
        
ans += 1

print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A.sort()
sm = 0
p = -1

for i in range(N-1):
    sm += A[i]
    if 2*sm < A[i+1]:
        p = i
    

print(N-p-1)

Solution (Python):
import sys

N = int(input())
A = list(map(int, sys.stdin.readline().rsplit()))
A.sort()

s = 0
res = 0

for i in range(N - 1):
    s += A[i]
    if s * 2 >= A[i + 1]:
        res += 1
    else:
        res = 0

print(res + 1)

Solution (Python):
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from math import factorial, sqrt, ceil, gcd
from functools import lru_cache, reduce
from decimal import Decimal
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def dijkstra_heap(s, edge, n):
    
    d = [10**20] * n
    used = [True] * n 
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


def lcm(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm, numbers, 1)


def gcd_list(numbers):
    return reduce(gcd, numbers)


def is_prime(n):
    if n <= 1:
        return False
    p = 2
    while True:
        if p ** 2 > n:
            break
        if n % p == 0:
            return False
        p += 1
    return True



def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P


def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret



n = int(input())
a = sorted(list(map(int, input().split())))

ruiseki = [0 for i in range(n)]
for i in range(n):
    if i == 0:
        ruiseki[i] = a[i]
    else:
        ruiseki[i] = a[i] + ruiseki[i - 1]


ans = 1
for i in reversed(range(n - 1)):
    if ruiseki[i] * 2 < a[i + 1]:
        break
    ans += 1
print(ans)

Solution (Python):
n = int(input())
arr = sorted([int(a) for a in input().split()])

res = 0
size = 0
for i in range(n-1):
    size += arr[i]
    if arr[i+1] > size * 2:
        res = 0
    else:
        res += 1
res += 1

print(res)

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
A.sort()
cnt=0
ans=1
for i,a in enumerate(A):
  
  if cnt*2>=a:    
    ans+=1
  else:
    ans=1
  cnt+=a
print(ans)