MathWorksOA #16
Maximize Beauty
估计中等可在线判题
考点(AI 标注)子序列
The beauty of an array is the number of 1-based positions i with arr[i]=i. You may repeatedly delete any element, as long as the array keeps a length of at least 1, and the order does not change. Find the maximum possible beauty.
This site uses a standard input/output protocol.
输入格式
The first line contains n; the second line contains n positive integers. 1≤n≤2000, 1≤arr[i]≤10^5.
输出格式
Output the maximum beauty.
样例 1
输入:
7
1 3 2 5 4 5 3
输出:
4
样例 2
输入:
6
6 3 2 4 3 4
输出:
3
样例 3
输入:
1
7
输出:
0
样例 4
输入:
3
2 2 2
输出:
1