implicit none

integer :: n
integer, allocatable :: h(:)
integer :: i
integer :: k

read *, n
allocate(h(n))
read *, (h(i), i = 1,n)

k = h(n)
do i = n-1, 1, -1
   if (h(i) > k+1) then
      write(6,'(a)') 'No'
      stop
   else if (h(i) < k) then
      k = h(i)
   endif
   if (k < 1) then
      write(6,'(a)') 'No'
      stop
   endif
enddo

write(6,'(a)') 'Yes'

stop
end