n = gets.chomp.to_i
lines = gets.chomp.split.map(&:to_i)

r = "Yes"
max = 1
prev = 0

for now in lines do

	max = now if (now > max)
	if (max - now > 1) then
		r = "No"
		break
	end
	if (now >= prev) then
		prev = now
	elsif ((now - 1) >= prev) then
		prev = now - 1
	elsif ((prev - 1) >= now) then
		prev -= 1
	else
		r = "No"
		break
	end

end

puts r
