stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <bits/stdc++.h>



#define pb push_back

#define mk make_pair

#define fr first

#define sc second



using namespace std;



const int N = 1e5 + 11;



int n, c, l;

long long a[N], d[N], sm, flag[N];

int main () {



       cin >> n;

       for(int i = 1;i <= n;i ++)

           cin >> a[i];

       c = n;

       sort(a + 1, a + n + 1);



       for(int i = 1;i < n;i ++)

       {

           sm += a[i];

           if(sm * 2 < a[i + 1]) c -= (i - l), l = i;

       }

       cout << c << endl;

}




// Faster C++ solution for the same problem (measured speedup: 5.241744125097251x):
#include <stdio.h>

#include <algorithm>

using namespace std;

main()

{

    int num;

    scanf("%d",&num);

    int animal[num];

    for (int i=0;i<num;i++)

    {

        scanf("%d",&animal[i]);

    }

    sort(animal,animal+num);

    long long sum=animal[0];

    long long cnt=1;

    for (int i=1;i<num;i++)

    {

        if (sum*2>=animal[i])

        {

            cnt++;

        }

        else

        {

            cnt=1;

        }

        sum+=animal[i];

    }

    printf("%d",cnt);

}
// Slower C++ solution:
#include <cstdio>

#include <cstring>

#include <string>

#include <iostream>

#include <algorithm>

using namespace std;



typedef long long ll;

const int maxn=1e5+5;

int a[maxn];

ll b[maxn];



int main()

{

    int n;

    scanf("%d",&n);

    for(int i=0;i<n;i++)

        scanf("%d",&a[i]);

    sort(a,a+n);

    b[0]=a[0];

    for(int i=1;i<n;i++)

    {

        b[i]=b[i-1]+a[i];

    }

    int cnt=1;

    for(int i=n-2;i>=0;i--)

    {

        if(b[i]*2>=a[i+1])

            cnt++;

        else

            break;

    }

    printf("%d\n",cnt);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.2027700799697465x):
#include <stdio.h>

#include <algorithm>

using namespace std;

main()

{

    int num;

    scanf("%d",&num);

    int animal[num];

    for (int i=0;i<num;i++)

    {

        scanf("%d",&animal[i]);

    }

    sort(animal,animal+num);

    long long sum=animal[0];

    long long cnt=1;

    for (int i=1;i<num;i++)

    {

        if (sum*2>=animal[i])

        {

            cnt++;

        }

        else

        {

            cnt=1;

        }

        sum+=animal[i];

    }

    printf("%d",cnt);

}
// Slower C++ solution:
#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#define ll long long

int line(const void*a,const void*b)

{

	return *(int *)a-*(ll *)b;

}

int main()

{

	ll s1[100010];

	ll judgesum[100010];

	ll a,n,sum;

	while(scanf("%lld",&n)!=EOF)

	{

		sum=0;

		for(a=1;a<=n;a++)

			scanf("%lld",&s1[a]);

		qsort(s1+1,n,sizeof(s1[1]),line);

		memset(judgesum,0,sizeof(judgesum));

		judgesum[1]=s1[1];

		for(a=2;a<=n;a++)

			judgesum[a]=judgesum[a-1]+s1[a];

		sum=1;

		for(a=n-1;a>=1;a--)

		{

			if(2*judgesum[a]>=s1[a+1])

				sum++;

            else break;

		}

		printf("%lld\n",sum);

	}

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.334170092333354x):
#include <stdio.h>

#include <algorithm>

using namespace std;

main()

{

    int num;

    scanf("%d",&num);

    int animal[num];

    for (int i=0;i<num;i++)

    {

        scanf("%d",&animal[i]);

    }

    sort(animal,animal+num);

    long long sum=animal[0];

    long long cnt=1;

    for (int i=1;i<num;i++)

    {

        if (sum*2>=animal[i])

        {

            cnt++;

        }

        else

        {

            cnt=1;

        }

        sum+=animal[i];

    }

    printf("%d",cnt);

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<algorithm>

#include<cmath>

#include<cstring>

#include<string>

#include<vector>

#include<map>

#include<queue>

#include<stack>

using namespace std;

long long s[100005];

long long vis[100005];

int main(){

	int n;

	while(scanf("%d",&n)==1)

	{

		for(int i=0;i<n;i++)

		scanf("%lld",&s[i]);

		sort(s,s+n);

		vis[0]=s[0];

		for(int i=1;i<n;i++)

		vis[i]=vis[i-1]+s[i];

		int sum=0;

		for(int i=n-1;i>=0;i--)

		if(s[i]<=vis[i-1]*2)sum++;

		else break;

		printf("%d\n",sum+1);

	}

	return 0;

} 

// Faster C++ solution for the same problem (measured speedup: 5.162485540716614x):
#include <stdio.h>

#include <algorithm>

using namespace std;

main()

{

    int num;

    scanf("%d",&num);

    int animal[num];

    for (int i=0;i<num;i++)

    {

        scanf("%d",&animal[i]);

    }

    sort(animal,animal+num);

    long long sum=animal[0];

    long long cnt=1;

    for (int i=1;i<num;i++)

    {

        if (sum*2>=animal[i])

        {

            cnt++;

        }

        else

        {

            cnt=1;

        }

        sum+=animal[i];

    }

    printf("%d",cnt);

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<cstring>

#include<queue>

#include<stack>

#include<cmath>

#include<algorithm>

#define inf 99999999

using namespace std;

typedef long long ll;

const int MAX=100000+10;

int cmp(int a,int b){

    return a<b;

}

ll a[MAX],b[MAX];

int main(){

    #ifdef SIYU

    //freopen("in.txt","r",stdin);

    #endif // SIYU

    int n;

    cin>>n;

    for(int i=0;i<n;i++)

        scanf("%lld",&a[i]);

    sort(a,a+n,cmp);

    for(int i=0;i<n;i++){

        if(i==0)    b[i]=a[i];

        else    b[i]=b[i-1]+a[i];

    }

    int countt=0;

    for(int i=n-1;i>=0;i--){

        if(a[i]<=b[i-1]*2)

            countt++;

        else

            break;

    }

    cout<<countt+1<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.242434199720206x):
#include <stdio.h>

#include <algorithm>

using namespace std;

main()

{

    int num;

    scanf("%d",&num);

    int animal[num];

    for (int i=0;i<num;i++)

    {

        scanf("%d",&animal[i]);

    }

    sort(animal,animal+num);

    long long sum=animal[0];

    long long cnt=1;

    for (int i=1;i<num;i++)

    {

        if (sum*2>=animal[i])

        {

            cnt++;

        }

        else

        {

            cnt=1;

        }

        sum+=animal[i];

    }

    printf("%d",cnt);

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<cstring>

#include<cmath>

#include<algorithm>

using namespace std;

long long a[1000000],b[1000000];

int main()

{

    int n;

    scanf("%d",&n);

    for(int i=0;i<n;i++)

    {

        scanf("%lld",&a[i]);

    }

    sort(a,a+n);

    b[0]=a[0];

    for(int i=0;i<n;i++)

    {

        b[i]=b[i-1]+a[i];

    }

    int cnt=0;

    for(int i=n-1;i>=0;i--)

    {

        if(a[i]<=2*b[i-1]) ++cnt;

        else

        {

            break;

        }

    }

    printf("%d\n",cnt+1);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.163260278551889x):
#include <stdio.h>

#include <algorithm>

using namespace std;

main()

{

    int num;

    scanf("%d",&num);

    int animal[num];

    for (int i=0;i<num;i++)

    {

        scanf("%d",&animal[i]);

    }

    sort(animal,animal+num);

    long long sum=animal[0];

    long long cnt=1;

    for (int i=1;i<num;i++)

    {

        if (sum*2>=animal[i])

        {

            cnt++;

        }

        else

        {

            cnt=1;

        }

        sum+=animal[i];

    }

    printf("%d",cnt);

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

using namespace std;

long long a[100005],sum[100005];

int main(){

	int n,i;

	long long cont;

	while(cin>>n){

		cont=0;

	 for (i=0;i<n;i++)

	 cin>>a[i];

	 sort(a,a+n);

	 sum[0]=a[0];

	 for (i=1;i<n;i++)

	 sum[i]=sum[i-1]+a[i];

	 for (i=n;i>0;i--)

	 if (a[i]<=sum[i-1]*2)

	 cont++;

	 else

	 break;

	 cout<<cont<<endl;

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.240609604039481x):
#include <stdio.h>

#include <algorithm>

using namespace std;

main()

{

    int num;

    scanf("%d",&num);

    int animal[num];

    for (int i=0;i<num;i++)

    {

        scanf("%d",&animal[i]);

    }

    sort(animal,animal+num);

    long long sum=animal[0];

    long long cnt=1;

    for (int i=1;i<num;i++)

    {

        if (sum*2>=animal[i])

        {

            cnt++;

        }

        else

        {

            cnt=1;

        }

        sum+=animal[i];

    }

    printf("%d",cnt);

}
// Slower C++ solution:
#include<stdio.h>

#include<algorithm>

#include<vector>

using namespace std;

int main()

{

    long n,k;

    scanf("%ld",&n);

    k=0;

    vector<long long> a(n);

    long long pre,sum;

    for(int i=0; i<n; i++)

    {

        scanf("%lld",&a[i]);

    }

    sort(a.begin(),a.end());

    pre=a[0];

    for(int i=1; i<n; i++)

    {

        sum=pre+a[i];

        //printf("%lld %lld %lld\n",a[i],pre,sum);

        if(2*pre<a[i]) k=i;

        pre=sum;

    }

    printf("%ld",n-k);





}


// Faster C++ solution for the same problem (measured speedup: 4.839962408059847x):
#include <stdio.h>

#include <algorithm>

using namespace std;

main()

{

    int num;

    scanf("%d",&num);

    int animal[num];

    for (int i=0;i<num;i++)

    {

        scanf("%d",&animal[i]);

    }

    sort(animal,animal+num);

    long long sum=animal[0];

    long long cnt=1;

    for (int i=1;i<num;i++)

    {

        if (sum*2>=animal[i])

        {

            cnt++;

        }

        else

        {

            cnt=1;

        }

        sum+=animal[i];

    }

    printf("%d",cnt);

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int n, a[100001];

long long sum[100001];

int main() {

	cin >> n;

	for(int i = 1; i <= n; i++) cin >> a[i];

	sort(a+1, a+n+1);

	for(int i = 1; i <= n; i++) sum[i] = sum[i-1] + a[i];

	for(int i = n-1; i >= 0; i--) {

		if(a[i+1] > 2*sum[i]) {

			cout << n-i;

			return 0;

		}

	}

}


// Faster C++ solution for the same problem (measured speedup: 5.218926043041847x):
#include <stdio.h>

#include <algorithm>

using namespace std;

main()

{

    int num;

    scanf("%d",&num);

    int animal[num];

    for (int i=0;i<num;i++)

    {

        scanf("%d",&animal[i]);

    }

    sort(animal,animal+num);

    long long sum=animal[0];

    long long cnt=1;

    for (int i=1;i<num;i++)

    {

        if (sum*2>=animal[i])

        {

            cnt++;

        }

        else

        {

            cnt=1;

        }

        sum+=animal[i];

    }

    printf("%d",cnt);

}
// Slower C++ solution:
# include <bits/stdc++.h>



# define pb push_back

# define fr first

# define sc second

# define mk make_pair



using namespace std;



const int inf = 1000000000 + 7;

const int N = 1e6 + 5;



typedef long long ll;



ll n, a[N], pref[N], ans;



inline void solve()

{

    cin >> n;



    for(int i = 1; i <= n; i ++)

        cin >> a[i];



    sort(a + 1, a + n + 1);



    for(int i = 1; i <= n; i ++)

        pref[i] = a[i] + pref[i - 1];

    for(int i = n; i >= 1; i --)

    {

        if(pref[i] * 2 >= a[i + 1])

            ans ++;

        else

            break;

    }



    cout << ans << endl;

}



int tests = 1;



int main()

{

//    scanf("%d", &tests);



    while(tests --)

        solve();

}


// Faster C++ solution for the same problem (measured speedup: 4.8293841076790995x):
#include<stdio.h>

#include<algorithm>

using namespace std;

int main()

{

	int n,a[100005],i,ans;

	unsigned long long sum;

	scanf("%d",&n);

	for(i=0;i<n;i++)

	scanf("%d",&a[i]);

	sort(a,a+n);

	sum=0;

	ans=0;

	for(i=0;i<n;i++)

	{

		if(a[i]<=2*sum)

		{

			sum+=a[i];

			ans++;

		}

		else

		{

			sum+=a[i];

			ans=1;

		}

	}

	printf("%d\n",ans);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



#define fr first

#define sc second

#define mk make_pair

#define pb push_back

#define ll long long

#define OK puts("OK");

#define sz(s) (int)s.size()

#define all(s) s.begin(), s.end()



using namespace std;



const int N = 1e5 + 10;

const int inf = 1e9 + 7;





int a[N], ans, n;

ll s;



main()

{

    scanf("%d", &n);

    for(int i = 1; i <= n; i++)

        scanf("%d", a + i);

    sort(a + 1, a + n + 1);

    ans = n;

    for(int i = 1 ; i < n ; i ++)

    {

        s += a[i];

        if(s * 2 < a[i + 1])

            ans = n - i;

    }

    cout << ans << endl;





}








// Faster C++ solution for the same problem (measured speedup: 4.831995357649654x):
#include<stdio.h>

#include<algorithm>

using namespace std;

int main()

{

	int n,a[100005],i,ans;

	unsigned long long sum;

	scanf("%d",&n);

	for(i=0;i<n;i++)

	scanf("%d",&a[i]);

	sort(a,a+n);

	sum=0;

	ans=0;

	for(i=0;i<n;i++)

	{

		if(a[i]<=2*sum)

		{

			sum+=a[i];

			ans++;

		}

		else

		{

			sum+=a[i];

			ans=1;

		}

	}

	printf("%d\n",ans);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



#define pb push_back

#define mk make_pair

#define sc second

#define fr first



using namespace std;



typedef long long ll;



const long long N = (long long) 1e6 + 5;

const long long mod = (long long) 1e9 + 7;



long long n,a[N],ans = 1,pr[N],dp[N];



int main(){

        cin >> n;



        for(long long i = 1; i <= n; i ++)

                cin >> a[i];



        sort(a + 1,a + n + 1);



        for(long long i = 1; i <= n; i ++)

                pr[i] = pr[i - 1] + a[i];



        dp[n] = 1;

        for(long long i = n - 1; i >= 1; i --){

                if(a[i + 1] <= pr[i] * 2 && dp[i + 1] == 1)

                        dp[i] = 1,ans ++;

        }

        cout << ans << endl;

        return 0;

}


// Faster C++ solution for the same problem (measured speedup: 4.830114734886016x):
#include<stdio.h>

#include<algorithm>

using namespace std;

int main()

{

	int n,a[100005],i,ans;

	unsigned long long sum;

	scanf("%d",&n);

	for(i=0;i<n;i++)

	scanf("%d",&a[i]);

	sort(a,a+n);

	sum=0;

	ans=0;

	for(i=0;i<n;i++)

	{

		if(a[i]<=2*sum)

		{

			sum+=a[i];

			ans++;

		}

		else

		{

			sum+=a[i];

			ans=1;

		}

	}

	printf("%d\n",ans);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



#define fr first

#define sc second

#define mk make_pair

#define pb push_back

#define pf push_front

#define pii pair <int ,int>

#define all(s) s.begin (), s.end ()

#define int long long



using namespace std;



const int N = 1e5 + 5;



int n, ar[N], pref[N];



main()

{

    cin >> n;

    for (int i = 1; i <= n; i++)

        scanf("%lld", &ar[i]);



    sort(ar + 1, ar + n + 1);



    for (int i = 1; i <= n; i++)

        pref[i] = ar[i] + pref[i - 1];



    for (int i = n - 1; i >= 0; i--)

    {

        if (pref[i] * 2 < ar[i + 1])

        {

            cout << n - i;

            return 0;

        }

    }



}


// Faster C++ solution for the same problem (measured speedup: 4.838112753022848x):
#include<stdio.h>

#include<algorithm>

using namespace std;

int main()

{

	int n,a[100005],i,ans;

	unsigned long long sum;

	scanf("%d",&n);

	for(i=0;i<n;i++)

	scanf("%d",&a[i]);

	sort(a,a+n);

	sum=0;

	ans=0;

	for(i=0;i<n;i++)

	{

		if(a[i]<=2*sum)

		{

			sum+=a[i];

			ans++;

		}

		else

		{

			sum+=a[i];

			ans=1;

		}

	}

	printf("%d\n",ans);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



#define pb push_back

#define mk make_pair

#define fr first

#define sc second



using namespace std;



const int N = 1e5 + 11;



int n, c, l;

long long a[N], d[N], sm, flag[N];

int main () {



       cin >> n;

       for(int i = 1;i <= n;i ++)

           cin >> a[i];

       c = n;

       sort(a + 1, a + n + 1);



       for(int i = 1;i < n;i ++)

       {

           sm += a[i];

           if(sm * 2 < a[i + 1]) c -= (i - l), l = i;

       }

       cout << c << endl;

}




// Faster C++ solution for the same problem (measured speedup: 4.848575109151982x):
#include<stdio.h>

#include<algorithm>

using namespace std;

int main()

{

	int n,a[100005],i,ans;

	unsigned long long sum;

	scanf("%d",&n);

	for(i=0;i<n;i++)

	scanf("%d",&a[i]);

	sort(a,a+n);

	sum=0;

	ans=0;

	for(i=0;i<n;i++)

	{

		if(a[i]<=2*sum)

		{

			sum+=a[i];

			ans++;

		}

		else

		{

			sum+=a[i];

			ans=1;

		}

	}

	printf("%d\n",ans);

	return 0;

}
// Slower C++ solution:
#include <cstdio>

#include <cstring>

#include <string>

#include <iostream>

#include <algorithm>

using namespace std;



typedef long long ll;

const int maxn=1e5+5;

int a[maxn];

ll b[maxn];



int main()

{

    int n;

    scanf("%d",&n);

    for(int i=0;i<n;i++)

        scanf("%d",&a[i]);

    sort(a,a+n);

    b[0]=a[0];

    for(int i=1;i<n;i++)

    {

        b[i]=b[i-1]+a[i];

    }

    int cnt=1;

    for(int i=n-2;i>=0;i--)

    {

        if(b[i]*2>=a[i+1])

            cnt++;

        else

            break;

    }

    printf("%d\n",cnt);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 4.812524401487063x):
#include<stdio.h>

#include<algorithm>

using namespace std;

int main()

{

	int n,a[100005],i,ans;

	unsigned long long sum;

	scanf("%d",&n);

	for(i=0;i<n;i++)

	scanf("%d",&a[i]);

	sort(a,a+n);

	sum=0;

	ans=0;

	for(i=0;i<n;i++)

	{

		if(a[i]<=2*sum)

		{

			sum+=a[i];

			ans++;

		}

		else

		{

			sum+=a[i];

			ans=1;

		}

	}

	printf("%d\n",ans);

	return 0;

}
// Slower C++ solution:
#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#define ll long long

int line(const void*a,const void*b)

{

	return *(int *)a-*(ll *)b;

}

int main()

{

	ll s1[100010];

	ll judgesum[100010];

	ll a,n,sum;

	while(scanf("%lld",&n)!=EOF)

	{

		sum=0;

		for(a=1;a<=n;a++)

			scanf("%lld",&s1[a]);

		qsort(s1+1,n,sizeof(s1[1]),line);

		memset(judgesum,0,sizeof(judgesum));

		judgesum[1]=s1[1];

		for(a=2;a<=n;a++)

			judgesum[a]=judgesum[a-1]+s1[a];

		sum=1;

		for(a=n-1;a>=1;a--)

		{

			if(2*judgesum[a]>=s1[a+1])

				sum++;

            else break;

		}

		printf("%lld\n",sum);

	}

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 4.934068455161493x):
#include<stdio.h>

#include<algorithm>

using namespace std;

int main()

{

	int n,a[100005],i,ans;

	unsigned long long sum;

	scanf("%d",&n);

	for(i=0;i<n;i++)

	scanf("%d",&a[i]);

	sort(a,a+n);

	sum=0;

	ans=0;

	for(i=0;i<n;i++)

	{

		if(a[i]<=2*sum)

		{

			sum+=a[i];

			ans++;

		}

		else

		{

			sum+=a[i];

			ans=1;

		}

	}

	printf("%d\n",ans);

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<algorithm>

#include<cmath>

#include<cstring>

#include<string>

#include<vector>

#include<map>

#include<queue>

#include<stack>

using namespace std;

long long s[100005];

long long vis[100005];

int main(){

	int n;

	while(scanf("%d",&n)==1)

	{

		for(int i=0;i<n;i++)

		scanf("%lld",&s[i]);

		sort(s,s+n);

		vis[0]=s[0];

		for(int i=1;i<n;i++)

		vis[i]=vis[i-1]+s[i];

		int sum=0;

		for(int i=n-1;i>=0;i--)

		if(s[i]<=vis[i-1]*2)sum++;

		else break;

		printf("%d\n",sum+1);

	}

	return 0;

} 

// Faster C++ solution for the same problem (measured speedup: 4.775261496308002x):
#include<stdio.h>

#include<algorithm>

using namespace std;

int main()

{

	int n,a[100005],i,ans;

	unsigned long long sum;

	scanf("%d",&n);

	for(i=0;i<n;i++)

	scanf("%d",&a[i]);

	sort(a,a+n);

	sum=0;

	ans=0;

	for(i=0;i<n;i++)

	{

		if(a[i]<=2*sum)

		{

			sum+=a[i];

			ans++;

		}

		else

		{

			sum+=a[i];

			ans=1;

		}

	}

	printf("%d\n",ans);

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<cstring>

#include<queue>

#include<stack>

#include<cmath>

#include<algorithm>

#define inf 99999999

using namespace std;

typedef long long ll;

const int MAX=100000+10;

int cmp(int a,int b){

    return a<b;

}

ll a[MAX],b[MAX];

int main(){

    #ifdef SIYU

    //freopen("in.txt","r",stdin);

    #endif // SIYU

    int n;

    cin>>n;

    for(int i=0;i<n;i++)

        scanf("%lld",&a[i]);

    sort(a,a+n,cmp);

    for(int i=0;i<n;i++){

        if(i==0)    b[i]=a[i];

        else    b[i]=b[i-1]+a[i];

    }

    int countt=0;

    for(int i=n-1;i>=0;i--){

        if(a[i]<=b[i-1]*2)

            countt++;

        else

            break;

    }

    cout<<countt+1<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.849213423148328x):
#include<stdio.h>

#include<algorithm>

using namespace std;

int main()

{

	int n,a[100005],i,ans;

	unsigned long long sum;

	scanf("%d",&n);

	for(i=0;i<n;i++)

	scanf("%d",&a[i]);

	sort(a,a+n);

	sum=0;

	ans=0;

	for(i=0;i<n;i++)

	{

		if(a[i]<=2*sum)

		{

			sum+=a[i];

			ans++;

		}

		else

		{

			sum+=a[i];

			ans=1;

		}

	}

	printf("%d\n",ans);

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<cstring>

#include<cmath>

#include<algorithm>

using namespace std;

long long a[1000000],b[1000000];

int main()

{

    int n;

    scanf("%d",&n);

    for(int i=0;i<n;i++)

    {

        scanf("%lld",&a[i]);

    }

    sort(a,a+n);

    b[0]=a[0];

    for(int i=0;i<n;i++)

    {

        b[i]=b[i-1]+a[i];

    }

    int cnt=0;

    for(int i=n-1;i>=0;i--)

    {

        if(a[i]<=2*b[i-1]) ++cnt;

        else

        {

            break;

        }

    }

    printf("%d\n",cnt+1);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 4.775978123158644x):
#include<stdio.h>

#include<algorithm>

using namespace std;

int main()

{

	int n,a[100005],i,ans;

	unsigned long long sum;

	scanf("%d",&n);

	for(i=0;i<n;i++)

	scanf("%d",&a[i]);

	sort(a,a+n);

	sum=0;

	ans=0;

	for(i=0;i<n;i++)

	{

		if(a[i]<=2*sum)

		{

			sum+=a[i];

			ans++;

		}

		else

		{

			sum+=a[i];

			ans=1;

		}

	}

	printf("%d\n",ans);

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

using namespace std;

long long a[100005],sum[100005];

int main(){

	int n,i;

	long long cont;

	while(cin>>n){

		cont=0;

	 for (i=0;i<n;i++)

	 cin>>a[i];

	 sort(a,a+n);

	 sum[0]=a[0];

	 for (i=1;i<n;i++)

	 sum[i]=sum[i-1]+a[i];

	 for (i=n;i>0;i--)

	 if (a[i]<=sum[i-1]*2)

	 cont++;

	 else

	 break;

	 cout<<cont<<endl;

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.847525685442958x):
#include<stdio.h>

#include<algorithm>

using namespace std;

int main()

{

	int n,a[100005],i,ans;

	unsigned long long sum;

	scanf("%d",&n);

	for(i=0;i<n;i++)

	scanf("%d",&a[i]);

	sort(a,a+n);

	sum=0;

	ans=0;

	for(i=0;i<n;i++)

	{

		if(a[i]<=2*sum)

		{

			sum+=a[i];

			ans++;

		}

		else

		{

			sum+=a[i];

			ans=1;

		}

	}

	printf("%d\n",ans);

	return 0;

}
// Slower C++ solution:
#include<stdio.h>

#include<algorithm>

#include<vector>

using namespace std;

int main()

{

    long n,k;

    scanf("%ld",&n);

    k=0;

    vector<long long> a(n);

    long long pre,sum;

    for(int i=0; i<n; i++)

    {

        scanf("%lld",&a[i]);

    }

    sort(a.begin(),a.end());

    pre=a[0];

    for(int i=1; i<n; i++)

    {

        sum=pre+a[i];

        //printf("%lld %lld %lld\n",a[i],pre,sum);

        if(2*pre<a[i]) k=i;

        pre=sum;

    }

    printf("%ld",n-k);





}


// Faster C++ solution for the same problem (measured speedup: 4.476929949440231x):
#include<stdio.h>

#include<algorithm>

using namespace std;

int main()

{

	int n,a[100005],i,ans;

	unsigned long long sum;

	scanf("%d",&n);

	for(i=0;i<n;i++)

	scanf("%d",&a[i]);

	sort(a,a+n);

	sum=0;

	ans=0;

	for(i=0;i<n;i++)

	{

		if(a[i]<=2*sum)

		{

			sum+=a[i];

			ans++;

		}

		else

		{

			sum+=a[i];

			ans=1;

		}

	}

	printf("%d\n",ans);

	return 0;

}