There are N 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, S_1<S_2<...<S_N holds lexicographically, where S_i is the i-th string from the left.

At least how many different characters are contained in S_1,S_2,...,S_N, if the length of S_i is known to be A_i?

Constraints

* 1 \leq N \leq 2\times 10^5
* 1 \leq A_i \leq 10^9
* A_i is an integer.

Input

Input is given from Standard Input in the following format:


N
A_1 A_2 ... A_N


Output

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

Examples

Input

3
3 2 1


Output

2


Input

5
2 3 2 1 2


Output

2
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
typedef long long ll;
const int MAX_N=2e5;
int N;
ll A[MAX_N];
bool C(ll x){
	map<int,ll> mp;
	REP(i,N-1){
		if (A[i]>=A[i+1]){
			auto ite=mp.lower_bound(A[i+1]);
			while(ite!=mp.end()){
				auto ite2=ite;
				ite2++;
				mp.erase(ite);
				ite=ite2;
			}
			ll inx=A[i+1]-1;
			do{
				if (mp[inx]!=x-1){
					mp[inx]++;
					break;
				}else{
					mp[inx]=0;
					inx--;
				}
			}while(inx>=0);
			if (inx<0){
				return false;
			}
		}
	}
	return true;
}
int main(){
	cin>>N;
	REP(i,N){
		cin>>A[i];
	}
	bool flg=true;
	REP(i,N-1){
		if (A[i]>=A[i+1]){
			flg=false;
		}
	}
	if (flg){
		cout<<1<<endl;
	}else{
		ll lb=1,ub=N;
		while(ub-lb>1){
			ll mid=(lb+ub)>>1;
			if (C(mid)){
				ub=mid;
			}else{
				lb=mid;
			}
		}
		cout<<ub<<endl;
	}
	return 0;
}