第三个测试点有时候会超,可以多提交两遍
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
int N = Integer.parseInt(br.readLine());
String[] s = br.readLine().trim().split(" ");
int i = 0;
for(i = N ; i > 0; i--) {
int cur = 0;
for(int j = 0; j < N; j++) {
if(Integer.parseInt(s[j]) > i)
cur++;
}
if(cur >= i) {
break;
}
}
System.out.println(i);
}
}