n = gets.to_i
h = gets.split.map(&:to_i)
flag = nil

h.each_with_index do |h_i, index|
  if (index + 1) < n
    x = h_i - h[index + 1]

    if x > 1
      puts 'No'
      exit
    elsif x == 1
      if flag == index
        puts 'No'
        exit
      end

      h_i = h_i - 1
      flag = index + 1
    end
  end
end

puts 'Yes'