output_description: Print the minimum possible number of different characters contained in the
  strings.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      A_1 A_2 ... A_N
attempt: N=int(input())
  alist=list(map(int,input().split()))
  
  def bsearch(X):
    amap={}
    for i in range(1,N):
      if alist[i-1]>=alist[i]:
        if alist[i] in amap:
          amap[alist[i]]+=1
        else:
          amap[alist[i]=1
        if amap[alist[i]]>=X:
          return False
  
        for key in list(amap.keys()):
          if key>alist[i]:
            del amap[key]
            
      #print(amap)
    return True
  
  l,r=1,N
  while(True):
    mid=(l+r)//2
    #print(l,r,mid)
    if bsearch(mid):
      if mid==1 or not bsearch(mid-1):
        break
      else:
        r=mid-1
    else:
      l=mid+1
  
  print(mid)
problem_description: Statement
  
  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?
samples: [{"input": "3\n    3 2 1", "output": "2\n    \n\nThe number of different characters contained in S_1,S_2,...,S_N would be 3\nwhen, for example, S_1=`abc`, S_2=`bb` and S_3=`c`.\n\nHowever, if we choose the strings properly, the number of different characters\ncan be 2.\n\n* * *"}, {"input": "5\n    2 3 2 1 2", "output": "2"}]