program main
  implicit none
  integer :: i, n
  integer,allocatable :: h(:)
  logical :: out = .true., prev = .false.

  read *, n
  allocate (h(n))
  read *, h

  do i = 2, n
    if (h(n-1) - h(n) >= 2) then
      out = .false.
      exit
    else if (h(n-1) - h(n) == 1) then
      if (prev) then
        out = .false.
        exit
      else
        prev = .true.
      end if
    else if (h(n-1) < h(n)) then
      prev = .false.
    end if
  end do

  if (out) then
    print '(a)', 'Yes'
  else
    print '(a)', 'No'
  end if
end program
