#P4445. [AHOI2018初中组] 报名签到

[AHOI2018初中组] 报名签到

Description

nn students (numbered from 11 to nn) arrive at the gym at the same time to register and check in, and to receive their admission tickets and contest materials. To keep the registration orderly, these nn students must line up in a straight line from front to back in increasing order of their numbers (the student with number 11 stands at the very front). However, each student dislikes crowding: for the ii-th student, if there is another student whose distance to him/her is less than aia_i, a conflict occurs. Xiao Keke wants to know, under the condition that no conflicts occur, what is the minimum possible length of the queue formed by these nn students.

Input Format

The first line contains an integer nn, the number of students.

The second line contains nn integers. The ii-th integer aia_i denotes the distance that the ii-th student must keep from other students.

Output Format

Output one line with a single integer, the minimum possible length of the queue formed by these nn students.

Note: The nn students must line up from front to back in the order 11 to nn.

3
3 1 2
5

Hint

For 20%20\% of the testdata: 1n201\le n\le 20.

For 70%70\% of the testdata: 1n1041\le n\le 10^4.

For 100%100\% of the testdata: 1n1051\le n\le 10^51ai1051\le a_i\le 10^5.

Translated by ChatGPT 5