program Build_Stairs
    implicit none
    integer(4):: n,i,nmax
    integer(4),allocatable:: h(:)

    read*, n
    allocate(h(n))
    read*, h(:)
    nmax=h(1)
    do i=2,n
        if (h(i) > nmax+1) then
            print*, 'No'
            stop
        end if
        nmax = h(i)
    end do
    print*, 'Yes'


end program Build_Stairs