program abc136c
   implicit none
   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


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

   num_negative =  sum(diff(:), mask=(diff<0))

   if (num_negative >= -1) then
      write(*,*) "Yes"
   else
      write(*,*) "No"
   end if




end program abc136c
