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

#include <cstdio>

#include <cmath>

#include <cstring>

#include <iostream>

#include <vector>

#include <map>

#include <set>

#include <queue>

#include <string>

#include <stack>

#include <fstream>

#include <iomanip>

#include <algorithm>

#include <functional>

//#include <unordered_set>

#define INF 2147483647

#define MAXN  1000100

#define PII pair<int, int>

#define mp(a,b) make_pair(a,b)

typedef long long ll;

typedef unsigned long long ull;

using namespace std;

const int maxn = 35;

ll a[MAXN];



int main()

{

	//ios::sync_with_stdio(false);

	cin.tie(0);

#ifdef local_debug

	ifstream inputs("input.txt");

	cin.rdbuf(inputs.rdbuf());

	freopen("input.txt", "r", stdin);

#endif

	int n;

	while (cin >> n) {

		a[n] = 0;

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

		sort(a, a + n);

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

		int ans = 1;

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

		{

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

				ans++;

			else

				ans = 1;

		}

		cout << ans-1 << endl;

	}

	return 0;

}


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

#include<algorithm>

using namespace std;

int main()

{

	int i,n,a[100005],temp=1;

	long long sum;

	scanf("%d",&n);

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

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

	sort(a,a+n);

	sum=(long long)a[0];

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

	{

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

		{

		   temp=1;

		   sum+=(long long)a[i];

		}

		else

		{

			temp++;

			sum+=(long long)a[i];

		}	

	}

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

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

#include<cstdio>

#include<algorithm>

using namespace std;

typedef long long ll;

ll a[100022];

//ll b[100022];

int main()

{

    int n;

    cin>>n;

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

    {

        cin>>a[i];

       // b[i]=a[i]*2;

    }

    int sum=1;

    sort(a,a+n);

    ll maxx=a[0];

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

    {

        if(maxx*2>=a[i])

        {

            sum++;

            maxx+=a[i];

        }

        else

        {

            sum=1;

            maxx+=a[i];

        }

    }

    cout<<sum<<endl;

    return 0;

}

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

#include<algorithm>

using namespace std;

int main()

{

	long long a[100002],i,j,n,k;

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

	{

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

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

		

		sort(a,a+n);

		k=0;

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

		{

			if(i>0)

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

			

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

			k=i+1;

		}

		printf("%lld\n",n-k);

	}

	return 0;

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

#include <cmath>

#include <stack>

#include <queue>

#include <string>

#include <vector>

#include <cstdio>

#include <cstring>

#include <iostream>

#include <algorithm>

#define lld long long

#define llu unsigned long long



using namespace std;

long long n,i,s,c,a[100010];

int main()

{



	scanf("%lld",&n);

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

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

	sort(a,a+n);

	for(c=1,s=i=0;i<n-1;i++)

	{

		s+=a[i];

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

			c++;

		else

			c=1;			

	}

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

	return 0;

}

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

#include<algorithm>

using namespace std;

int main()

{

	long long a[100002],i,j,n,k;

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

	{

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

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

		

		sort(a,a+n);

		k=0;

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

		{

			if(i>0)

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

			

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

			k=i+1;

		}

		printf("%lld\n",n-k);

	}

	return 0;

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

#include <cstdio>

#include <cmath>

#include <cstring>

#include <iostream>

#include <vector>

#include <map>

#include <set>

#include <queue>

#include <string>

#include <stack>

#include <fstream>

#include <iomanip>

#include <algorithm>

#include <functional>

//#include <unordered_set>

#define INF 2147483647

#define MAXN  1000100

#define PII pair<int, int>

#define mp(a,b) make_pair(a,b)

typedef long long ll;

typedef unsigned long long ull;

using namespace std;

const int maxn = 35;

ll a[MAXN];



int main()

{

	//ios::sync_with_stdio(false);

	cin.tie(0);

#ifdef local_debug

	ifstream inputs("input.txt");

	cin.rdbuf(inputs.rdbuf());

	freopen("input.txt", "r", stdin);

#endif

	int n;

	while (cin >> n) {

		a[n] = 0;

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

		sort(a, a + n);

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

		int ans = 1;

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

		{

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

				ans++;

			else

				ans = 1;

		}

		cout << ans-1 << endl;

	}

	return 0;

}


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

#include<algorithm>

using namespace std;

int main()

{

	long long a[100002],i,j,n,k;

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

	{

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

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

		

		sort(a,a+n);

		k=0;

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

		{

			if(i>0)

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

			

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

			k=i+1;

		}

		printf("%lld\n",n-k);

	}

	return 0;

 }
// 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: 5.2099330691435x):
#include<cstdio>

#include<algorithm>

using namespace std;

const int N = 100000 + 10;

typedef long long LL;

LL a[N],b[N];

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=1;i<n;i++) b[i]=b[i-1]+a[i];

	int num=0;

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

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

		else break;

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

	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: 5.212750082093818x):
#include<cstdio>

#include<algorithm>

using namespace std;

const int N = 100000 + 10;

typedef long long LL;

LL a[N],b[N];

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=1;i<n;i++) b[i]=b[i-1]+a[i];

	int num=0;

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

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

		else break;

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

	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: 5.210721268790009x):
#include<cstdio>

#include<algorithm>

using namespace std;

const int N = 100000 + 10;

typedef long long LL;

LL a[N],b[N];

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=1;i<n;i++) b[i]=b[i-1]+a[i];

	int num=0;

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

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

		else break;

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

	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: 5.2193495199809705x):
#include<cstdio>

#include<algorithm>

using namespace std;

const int N = 100000 + 10;

typedef long long LL;

LL a[N],b[N];

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=1;i<n;i++) b[i]=b[i-1]+a[i];

	int num=0;

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

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

		else break;

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

	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: 5.230636295678033x):
#include<cstdio>

#include<algorithm>

using namespace std;

const int N = 100000 + 10;

typedef long long LL;

LL a[N],b[N];

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=1;i<n;i++) b[i]=b[i-1]+a[i];

	int num=0;

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

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

		else break;

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

	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: 5.191744840817187x):
#include<cstdio>

#include<algorithm>

using namespace std;

const int N = 100000 + 10;

typedef long long LL;

LL a[N],b[N];

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=1;i<n;i++) b[i]=b[i-1]+a[i];

	int num=0;

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

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

		else break;

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

	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: 5.32286640217514x):
#include<cstdio>

#include<algorithm>

using namespace std;

const int N = 100000 + 10;

typedef long long LL;

LL a[N],b[N];

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=1;i<n;i++) b[i]=b[i-1]+a[i];

	int num=0;

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

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

		else break;

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

	return 0;

}
// 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: 5.216329348077275x):
// hi yhoam



#include <cstdio>

#include <algorithm>



using namespace std;



long long A[int(1e6)+5];



int main(){

    int N;

    scanf("%d",&N);

    for(int c = 0 ; c < N ; c++)

        scanf("%lld",&A[c]);

    sort(A, A+N);

    int sol = 1;

    long long run = A[0];

    for(int c = 1 ; c < N ; c++){

        if(run*2 >= A[c])

            sol++;

        else

            sol = 1;

        run += A[c];

        // printf("%d; %d %d\n",A[c],sol,run);

    }

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

}
// 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: 5.21914981949824x):
// hi yhoam



#include <cstdio>

#include <algorithm>



using namespace std;



long long A[int(1e6)+5];



int main(){

    int N;

    scanf("%d",&N);

    for(int c = 0 ; c < N ; c++)

        scanf("%lld",&A[c]);

    sort(A, A+N);

    int sol = 1;

    long long run = A[0];

    for(int c = 1 ; c < N ; c++){

        if(run*2 >= A[c])

            sol++;

        else

            sol = 1;

        run += A[c];

        // printf("%d; %d %d\n",A[c],sol,run);

    }

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

}
// 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: 5.217118515403163x):
// hi yhoam



#include <cstdio>

#include <algorithm>



using namespace std;



long long A[int(1e6)+5];



int main(){

    int N;

    scanf("%d",&N);

    for(int c = 0 ; c < N ; c++)

        scanf("%lld",&A[c]);

    sort(A, A+N);

    int sol = 1;

    long long run = A[0];

    for(int c = 1 ; c < N ; c++){

        if(run*2 >= A[c])

            sol++;

        else

            sol = 1;

        run += A[c];

        // printf("%d; %d %d\n",A[c],sol,run);

    }

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

}
// 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: 5.225757359571154x):
// hi yhoam



#include <cstdio>

#include <algorithm>



using namespace std;



long long A[int(1e6)+5];



int main(){

    int N;

    scanf("%d",&N);

    for(int c = 0 ; c < N ; c++)

        scanf("%lld",&A[c]);

    sort(A, A+N);

    int sol = 1;

    long long run = A[0];

    for(int c = 1 ; c < N ; c++){

        if(run*2 >= A[c])

            sol++;

        else

            sol = 1;

        run += A[c];

        // printf("%d; %d %d\n",A[c],sol,run);

    }

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

}
// 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.237057992138288x):
// hi yhoam



#include <cstdio>

#include <algorithm>



using namespace std;



long long A[int(1e6)+5];



int main(){

    int N;

    scanf("%d",&N);

    for(int c = 0 ; c < N ; c++)

        scanf("%lld",&A[c]);

    sort(A, A+N);

    int sol = 1;

    long long run = A[0];

    for(int c = 1 ; c < N ; c++){

        if(run*2 >= A[c])

            sol++;

        else

            sol = 1;

        run += A[c];

        // printf("%d; %d %d\n",A[c],sol,run);

    }

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

}
// 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.198118789909074x):
// hi yhoam



#include <cstdio>

#include <algorithm>



using namespace std;



long long A[int(1e6)+5];



int main(){

    int N;

    scanf("%d",&N);

    for(int c = 0 ; c < N ; c++)

        scanf("%lld",&A[c]);

    sort(A, A+N);

    int sol = 1;

    long long run = A[0];

    for(int c = 1 ; c < N ; c++){

        if(run*2 >= A[c])

            sol++;

        else

            sol = 1;

        run += A[c];

        // printf("%d; %d %d\n",A[c],sol,run);

    }

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

}
// 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.329401330317917x):
// hi yhoam



#include <cstdio>

#include <algorithm>



using namespace std;



long long A[int(1e6)+5];



int main(){

    int N;

    scanf("%d",&N);

    for(int c = 0 ; c < N ; c++)

        scanf("%lld",&A[c]);

    sort(A, A+N);

    int sol = 1;

    long long run = A[0];

    for(int c = 1 ; c < N ; c++){

        if(run*2 >= A[c])

            sol++;

        else

            sol = 1;

        run += A[c];

        // printf("%d; %d %d\n",A[c],sol,run);

    }

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

}
// 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.157870265139407x):
// hi yhoam



#include <cstdio>

#include <algorithm>



using namespace std;



long long A[int(1e6)+5];



int main(){

    int N;

    scanf("%d",&N);

    for(int c = 0 ; c < N ; c++)

        scanf("%lld",&A[c]);

    sort(A, A+N);

    int sol = 1;

    long long run = A[0];

    for(int c = 1 ; c < N ; c++){

        if(run*2 >= A[c])

            sol++;

        else

            sol = 1;

        run += A[c];

        // printf("%d; %d %d\n",A[c],sol,run);

    }

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

}