program build_stairs
  implicit none
  integer :: n, h(100000) = 0, i
  read(*,*) n
  read(*,*) h(1:n)
  do i = n-1, 1, -1
    if (h(i) > h(i+1)) h(i) = h(i)-1
    if (h(i) > h(i+1)) then
      write(*,'(a)') "No"
      stop
    end if
  end do
  write(*,'(a)') "Yes"
  stop
end program build_stairs