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())
  A = [int(i) for i in input().split()]
  a = A[0]
  t = 1
  s = -1
  for i in range(1, N):
      if a >= A[i]:
          s = i
          t += 1
          break
  l = [A[s], 1]
  for i in range(s + 1, N):
      if l[0] < A[i]:
          # print(i,t,':',l,A[i])
          continue
      elif l[0] == A[i]:
          if t ** (l[0]) >= l[1] - 1:
              t += 1
              l[1] = t ** (A[i] - 1) * (t - 1)
          else:
              l[1] += 1
          print(i, t, ":", l, A[i])
      else:
          a = l[0]
          b = l[1]
          x = b // (t ** (a - A[i]))
          l = [A[i], x]
          if t ** (l[0]) - 1 == x:
              t += 1
              l[1] = t ** (A[i] - 1) * (t - 1)
          else:
              l[1] += 1
  print(t)
  
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"}]