YES = 'Yes'
NO = 'No'

n = gets.to_i
a = gets.split.map(&:to_i)

b = []
r = ''
n.times do
  num = a.shift
  if a.find{|n| n < num-1}
    r = NO
    break
  elsif a.find{|n| n < num}
    num -= 1
  end
  b.push(num)
end
if r == NO
  print r
else
r = YES
b.each_with_index do |num, i|
  next_num = b[i+1]
  if next_num.nil?
    print r
    break
  end
  if num > next_num
    r = NO
  end
end
end
