n = gets.to_i
hs = gets.split.map &:to_i

is_ok = true

diffs = []

(0 .. hs.size - 2).each{ |i|
	diffs << hs[i] - hs[i+1]
}

is_sub = false

diffs.each{ |diff|
	if diff > 1 || (diff == 1 and is_sub) then
		is_ok = false
	elsif diff == 1 then
		is_sub = true
	else
		is_sub = false
	end
}

if is_ok then
	puts 'Yes'
else
	puts 'No'
end
