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

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

  x = A[0]

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

    while mp[y] == k && y > 0
      y -= 1
    end

    if y == 0
      return false
    end

    mp[y] += 1
    mp.delete_if { |i| i > y }

    x = y
  end

  true
end

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