#agc029c. [agc029_c]Lexicographic constraints

[agc029_c]Lexicographic constraints

Problem Statement

There are NN strings arranged in a row. It is known that, for any two adjacent strings, the string to the left is lexicographically smaller than the string to the right. That is, S1<S2<...<SNS_1<S_2<...<S_N holds lexicographically, where SiS_i is the ii-th string from the left.

At least how many different characters are contained in S1,S2,...,SNS_1,S_2,...,S_N, if the length of SiS_i is known to be AiA_i?

Constraints

  • 1leqNleq2times1051 \\leq N \\leq 2\\times 10^5
  • 1leqAileq1091 \\leq A_i \\leq 10^9
  • AiA_i is an integer.

Note

The strings do not necessarily consist of English alphabet; there can be arbitrarily many different characters (and the lexicographic order is defined for those characters).


Input

Input is given from Standard Input in the following format:

NN A1A_1 A2A_2 ...... ANA_N

Output

Print the minimum possible number of different characters contained in the strings.


Sample Input 1

3
3 2 1

Sample Output 1

2

The number of different characters contained in S1,S2,...,SNS_1,S_2,...,S_N would be 33 when, for example, S1=S_1=abc, S2=S_2=bb and S3=S_3=c.

However, if we choose the strings properly, the number of different characters can be 22.


Sample Input 2

5
2 3 2 1 2

Sample Output 2

2