n = gets.to_i
arr = gets.chomp.split(' ').map(&:to_i)
down_flag = 0
for i in 0..(n-2)
  if arr[i] > arr[i+1] + 1
    puts "No"
    exit
  elsif arr[i] == arr[i+1] + 1
    if down_flag == 1
      puts "No"
      exit
    else
      down_flag = 1
    end
  elsif arr[i] <= arr[i+1]
    down_flag = 0
  end
end
puts "Yes"