n = gets.to_i
num = gets.strip.split.map(&:to_i)
if n==1
  puts "Yes"
  exit
end
s = 1
i = n-1
while i > 0 do
  if num[i]==num[i-1]-1
    num[i-1] -= 1
  elsif num[i]<num[i-1]-1
    s = 0
    break
  end
  i -= 1
end
if s==0
  puts "No"
else
  if num.sort == num
    puts "Yes"
  else
    puts "No"
  end
end