n = gets.strip.to_i
h = gets.strip.split.map(&:to_i)

if (h.min+1 == h.max)
  puts 'Yes'
  exit
end

min=0
(n-1).times do |index|

  if h[index]-1 > h[index+1]
    puts 'No'
    exit
  end

  min = h[index]  if h[index] > min
  if h[index]-1 == h[index+1]
    min -=1
  end

end

puts 'Yes'
