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

PROGRAMMING:Hero card

Luz5年前 (2021-05-10)题库462
Xiao Li is very infatuated with collecting hero cards in all kinds of instant noodles. For this reason, he only ate instant noodles for a month in a row, but some rare hero cards are too difficult to collect. Later, a shopping mall held a hero card exchange activity. As long as you have three consecutive hero cards, you can exchange any number of hero cards. Xiao Li wants to know how many hero cards he can exchange at most (new hero cards can't be exchanged again).
###Input format:
The first line, a total of an integer n, represents the number of hero cards owned by Xiao Li.
The second line, a total of N spaces separated by the number AI, represents the hero card number.
###Output format:
Output only one line, a total of 1 integer, that Xiao Li can change up to the hero card.
###Input example:
```in
six
3 1 2 4 4 5
```
###Output example:
```out
one
```
[example description]
The number of 1, 2, 3 is consecutive, you can change one, after changing, there are 4, 4, 5 left, which is not in line with the exchange rules and cannot continue to exchange.
[data scale]
70% data, 1 < = n < = 1000
100% data, 1 < = n < = 10000, 1 < = AI < = 100000







answer:If there is no answer, please comment