program r20711d

implicit none
integer :: n, i, j, z, c, k
character(len=200000) :: x
integer(16), allocatable :: a(:), p(:)

read *, n
allocate(a(1:n))
allocate(p(1:n))

a = 0
p = 0

read *, x
do i = 1, n
 if(x(i:i)=='1') then
  do j = 1, i-1
   a(i) = a(i) + int(x(j:j)) * 2 ** (n - j)
   p(i) = p(i) + 1
  end do
  do j = i+1, n
   a(i) = a(i) + int(x(j:j)) * 2 ** (n - j)
   p(i) = p(i) + 1
  end do
 else
  do j = 1, n
   a(i) = a(i) + int(x(j:j)) * 2 ** (n - j)
   p(i) = p(i) + 1
  end do
  a(i) = a(i) + 2 ** (n - i)
  p(i) = p(i) + 1
 end if
end do

do i = 1, n
 z = 0
 j = 0
 c = 0
 a(i) = mod(a(i),p(i))
 p(i) = 0
 do while(a(i) > 0)
  if(mod(a(i),2**j) == 1) then
  a(i) = a(i) - 2 ** j
  p(i) = p(i) + 1
  end if
  c = c + 1
 end do
 
 do k = 1, c
  
  

end program r20711d