n = gets.to_i
array = readline.split(' ').map(&:to_i)

ans = 'No'
array.each_with_index do |e, i|
  if i == array.size - 1
    ans = "Yes"
    break
  end

  if e > array[i + 1]
    if e - array[i + 1] == 1
      next
    else
      ans = "No"
      break
    end
  end
end

if n == 1
  ans = "Yes"
end

puts ans
