program main
  implicit none
  integer :: n, i, x
  integer, allocatable :: h(:)
  read (*, *) n
  allocate (h(n))
  read (*, *) h(:)
  x = h(n)
  do i = n - 1, 1, -1
    if (h(i) <= x) then
      continue
    else if (h(i) == x + 1) then
      h(i) = x
    else
      write (*, "(a)") "No"
      stop
    end if
    x = h(i)
  end do
  write (*, "(a)") "Yes"
end program main
