lines = []
while line = gets
    lines << line.chomp.split(' ').map(&:to_i)
end

N = lines[0][0]

ans = "Yes"
twice = false
for i in 2..N do
  ecart = lines[1][i-1] - lines[1][i-2]
  if ecart == 0 then
    twice = true
  elsif ecart == -1 then
    if twice then
      ans = "No"
    else
      twice = true
    end
  else
    twice = false
  end
end
  
print ans