-->
当前位置:首页 > 题库

PROGRAMMING:Simple sequence

Luz5年前 (2021-05-10)题库381
Although MSH has grown up, she still likes to find some games to amuse herself. One day, she wrote a series of numbers on the paper: 1, 1, 2, 5, 4. Then she erased a 1 and found that the remaining 1, 2 and 4 were in her own position, that is, 1 was in the first place, 2 was in the second place, and 4 was in the fourth place. She wants to erase a number, the rest of the sequence in their own position as many numbers. She found the game very interesting, so she began to play it happily... But she was not sure how many numbers she could have at most in her own position, so I found you, please help me calculate!
###Input format:
The first line is a number n, which represents the length of the sequence.
Next, n numbers, one positive integer at a time, and the ith represents the number AI.
###Output format:
An integer in a row indicates the maximum number of numbers in the remaining sequence after erasing a number, that is, the maximum number of AI = I.
###Input example:
Here is a set of inputs. For example:
```in
five
1 1 2 5 4
```
###Output example:
The corresponding output is given here. For example:
```out
three
```







answer:If there is no answer, please comment