A,B=gets.split.map &:to_i
X,Y=[A-1,B].map{|x|
    l=[]
    i=0
    while 2**i<=x
        t=(x-2**i)/(2*2**i)*(2**i)
        l << (t+[x+1-2**i-2*t,2**i].min)%2
        i+=1
    end
    l.reverse.join("").to_i(2)
}
p X^Y