program kadai
implicit none
integer ::  n,i
integer,allocatable :: h(:)


read(*,*) n
allocate(h(n))
read(*,*) h

do i=1,n-1
    if (h(i+1)-h(i)<-1) then
        write(*,*) "No"
        stop
    end if
    if (h(i+1)-h(i)==-1) then
        h(i+1)=h(i+1)+1
    end if
end do

write(*,*) "Yes"


stop

end program kadai