#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int n;
cin>>n;
vector<int>v;
for(int i=0;i<n;++i){
int x;
cin>>x;
v.push_back(x);
}
sort(v.begin(),v.end());
int cnt=0,sum=0;
for(int i=0;i<v.size();++i){
if(sum+v[i]>=(cnt+1+1)*(cnt+1)/2) sum+=v[i],++cnt;
}
cout<<cnt;
}