
ZOJ Problem Set  3590
ZOJ is 10 years old! For celebrating, we are offering the easiest problem in the world to you. Recently we received a long sequence. We can modify the sequence once by the following two steps.
Now, we want to know how many times at most the sequence can be modified. InputThe input contains multiple test cases. For each case, the first line contains an integer n(1 ≤ n ≤ 20000). The second line contains n integers describing the sequence. All the numbers in the sequence are nonnegative and not greater than 1000000. OutputOutput number of times at most the sequence can be modified, one line per case. Sample Input1 10 2 10 11 Sample Output4 10 Author: ZHUANG, Junyuan Contest: ZOJ 10th Anniversary Contest 