#1行目
hoge = gets.chomp.to_i

#2行目読み込み
x = gets.chomp.split(" ").map!{|i | i.to_i} 
x[hoge] = 10000000000

sageta = Array.new

unchi = 0

for i in 0..(hoge-1) do
  if x[i] - x[i+1] > 1
    unchi = 1
    break
  elsif x[i] - x[i+1] == 1 and sageta[i] == nil
    sageta[i + 1] = "下げたよ！"
  elsif x[i] - x[i+1] == 1 and sageta[i] != nil
    unchi = 1
    break
  end
end

if unchi > 0
  print "No"
else print "Yes"
end
