print((function (a, b) local ba,bx,ls = bit.band,bit.bxor,bit.lshift while b ~= 0 do local t=ls(ba(a,b),1) a,b=bx(a,b),t end return a end)(io.stdin:read("*n"), io.stdin:read("*n")))