require 'pp'
require 'set'

n = gets.chomp!.to_i
h_n = gets.chomp!.split(" ").map(&:to_i)

count = 0
h_n.each_cons(2) do |x, y|
    if y - x == -1
        count += 1
    elsif y - x < -1
        count += 2
    end
end

if count <= 1
    puts "Yes"
else
    puts "No"
end



