program ms
  integer :: N
  integer,allocatable :: H(:)

  integer :: i,zti
  logical :: ok 

  read(*,*) N
  allocate(H(N))
  read(*,*) H
  ok=.true.
  if(N.gt.1) then
     zti=H(1)
     do i=2,N
        if(H(i).gt.(zti+1)) then
           zti=H(i)-1
        elseif(H(i).lt.zti) then
           ok=.false.
        else
        endif
     enddo
  endif

  if(ok) then
     write(*,'(a)') 'Yes'
  else
     write(*,'(a)') 'No'
  endif

end program ms

