program abc136c
   implicit none
   logical :: flag=.true.
   integer(8) :: n, num_negative, i
   integer(8),allocatable :: h(:), diff(:)

   read(*,*) n

   allocate(h(n), diff(n-1))
   read(*,*) h(:)

   if (n == 1) then
      write(*,*) "Yes"
      stop
   end if

   diff = 0
   do i = 1, n-1
      diff(i) = h(i+1) - h(i)
   enddo



   do i = 1, n-1
      if ( diff(i) == -1) then
         if(diff(i-1) == 1) then
            flag = .true.
         else
            flag = .false.
         endif
      endif
   enddo

   if (minVal(diff) <= -2) flag = .false.

   ! ans
   if (flag) then
      write(*,*) "Yes"
   else
      write(*,*) "No"
   endif


end program abc136c
