program many_slimes
  implicit none
  integer :: n, m, s(262144) = 0, i, j
  integer :: x(262144) = 0, nx = 1, y(131072), ny
  read(*,*) n
  m = 2**n
  read(*,*) s(1:m)
  call bitonic_sort(s(1:m),.false.)
  x(1) = s(1)
  s(1) = -1
  do i = 1, n
    y(1:nx) = x(1:nx)
    ny = nx
    call bitonic_sort(y(1:ny),.true.)
    do j = 1, m
      if (s(j) < 0) cycle
      if (s(j) < y(ny)) then
        nx = nx+1
        x(nx) = s(j)
        s(j) = -1
        ny = ny-1
        if (ny == 0) exit
      end if
    end do
    if (ny > 0) then
      write(*,'(a)') "No"
      stop
    end if
  end do
  write(*,'(a)') "Yes"
contains
  recursive subroutine bitonic_sort(a,ascend)
    integer, intent(inout) :: a(:)
    logical, intent(in) :: ascend
    integer :: n
    n = size(a)
    if (n == 1) return
    call bitonic_sort(a(1:n/2),.not.ascend)
    call bitonic_sort(a(n/2+1:n),ascend)
    call bitonic_merge(a,ascend)
  end
  recursive subroutine bitonic_merge(a,ascend)
    integer, intent(inout) :: a(:)
    logical, intent(in) :: ascend
    integer :: n, m, i, b
    n = size(a)
    if (n == 1) return
    m = 1
    do while (2*m < n)
      m = 2*m
    end do
    do i = 1, n-m
      if ((a(i) > a(i+m)) .eqv. ascend) then
        b = a(i)
        a(i) = a(i+m)
        a(i+m) = b
      end if
    end do
    call bitonic_merge(a(1:m),ascend)
    call bitonic_merge(a(m+1:n),ascend)
  end
end program many_slimes