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

command = false

0.upto(N - 2) do |i|
  if H[i] - 1 > H[i + 1]
    puts 'No'
    exit
  elsif H[i] - 1 == H[i + 1]
    if command
      puts 'No'
      exit
    else
      command = true
    end
  else
    command = false
  end
end

puts 'Yes'