program abc171
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,i,j,cnt(0:30)=0
    integer(int32), allocatable:: a(:),b(:)

    read*, n
    allocate(a(n),b(n))
    read*, a(:)

    do i=1,n
        print'(b0)', a(i) 
    end do

    do i=1,n
        do j=0,30
            if (btest(a(i),j)) cnt(j)=cnt(j)+1
        end do
    end do

    do i=1,n
        do j=0,30
            if (mod(cnt(j),2) == 0 .neqv. btest(a(i),j)) then
                a(i)=ibclr(a(i),j)
            else
                a(i)=ibset(a(i),j)
            end if
        end do
    end do

    print'(*(i0,1x))', a(:)
end program abc171