P28624 [洛谷] Building Blocks with Saruka
提高-
题目描述

Problem Description

Saruka loves building blocks very much. He has a total of $n$ blocks. What's special about Saruka's blocks is that they can only be stacked vertically, and multiple columns can be formed. These blocks are quite intelligent; each block has an emotional value $x_i$. When the number of blocks stacked on top of block $i$ exceeds $x_i$, this block becomes very unhappy and vows never to play with Saruka again. Saruka, who loves playing with blocks, certainly doesn't want any blocks to be unhappy. However, he also hopes that every block is used and the number of columns is minimized. Can you help Saruka?

Input Format

The first line contains an integer $n$, as described in the problem statement.

The second line contains $n$ numbers $x_i$, as described in the problem statement.

Output Format

Output a single number representing the minimum number of columns of blocks.

Sample Input and Output

Sample Input #1

3
0 0 3

Sample Output #1

2

Sample Input #2

4
0 0 0 0

Sample Output #2

4

Notes

For $100\%$ of the data, $1 \le n \le 5000$, and $0 \le x_i \le n$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 0 0 3
样例输出
2