for(;b=readline(z=1).split(" ");print(z))for(;x=b[1];z&=/^10*$/.test(x.toString(2)))x^=b.shift()