program many_slimes
  implicit none
  integer :: n, m, s(262145) = 0, k(0:18) = 1, i, j, l
  read(*,*) n
  m = 2**n
  read(*,*) s(1:m)
  call bitonic_sort(s(1:m),.false.)
  do i = 1, (n+1)/2
    do j = 1, i
      k(i) = k(i)*(n-i+j)/j
    end do
  end do
  i = 1
  j = 1
  l = 0
  do while (i <= m)
    do while (s(j) == s(i))
      j = j+1
    end do
    if (j-i > k(l)) then
      write(*,'(a)') "No"
      stop
    end if
    i = j
    l = l+1
    if (l > (n+1)/2) exit
  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