program main
  implicit none

  integer :: n, i, no, two
  integer, allocatable, dimension ( : ) :: H
  no  = 0
  two = 0
  read *, n

  allocate ( H ( n ) )

!  do i = 1, n
     read *, H ( : )
!     print *, H ( i )
!  end do

  do i = 1, n - 1
     if ( H ( i ) > H ( i + 1 ) ) then
        H ( i ) = H ( i ) - 1
        if ( H ( i ) /= H ( i + 1 ) ) then
           no = 1
           exit
        else if ( i - two == 1 ) then
           no = 1
           exit
        end if
        two = i
     end if
  end do
  
  if ( no == 0 ) then
     print *, "yes"
  else
     print *, "no"
  end if

end program main
