#include<bits/stdc++.h> using namespace std; int a[1000005],n ; int main() { cin >> n ; for(int i = 1 ; i <= n ; i++)cin >> a[i] ; sort(a+1,a+n+1) ; long long tot=1,s=1 ;//tot:目前遍历下标,s:目前所需题目数量 while(tot!=n){ if(a[tot]>=s)s++ ; tot++ ; } cout << s-- ; return 0; }