program main
 implicit none
 integer*8 N,i,flag
 integer*8, allocatable::H(:)
 read(*,*) N
 allocate(H(1:N))
 read(*,*) H
 flag = 0
 do i=1,N
  if(i>1)then
   if(H(i-1) - H(i) > 1) then
    flag = -1
    exit
   else if(H(i-1) - H(i) == 1) then
    H(i-1) = H(i-1) - 1
    if(i>2) then
     if(H(i-2) > H(i-1))then
      flag = -1
      exit
     end if
    end if
   end if
  end if
 end do
 
 if(flag == 0) then
  write(*,*) 'Yes'
 else 
  write(*,*) 'No'
 end if
end program main