#include <iostream>
#include <algorithm>
using namespace std;
int a[1000000];
bool cmp1(int a, int b) {
return a > b;
}
int main() {
int n;
cin>>n;
for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
sort(a+1, a+n+1, cmp1);
int ans = 0, p = 1;
while(ans <= n && a[p] > p) {
ans++;
p++;
}
cout<<ans<<endl;
return 0;
}
02-27
141
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-26
112
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-22
150
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)