N = gets.to_i
A = gets.split.map(&:to_i)

K = [*1..A.max]

ok = A.max
ng = 0

def f(k)
  mp = Hash.new(1)

  x = A[0]

  A[1..-1].each do |y|
    next if x < y

    t = y

    while mp[y] == k & y > 0
      mp.delete(y)
      y -= 1
    end

    if y == 0
      return false
    end

    mp[y] += 1

    x = t
  end

  true
end

puts (2..A.max).bsearch { |k| f(k) }
