A,B=$<.read.split.map(&:to_i)

def g(x)
    (x.even? ? x : 0) ^ ((x+1)/2) & 1
end

puts g(A-1) ^ g(B)

# def g(x,i)
#     n = 1<<i
#     m = 1<<(i-1)
#     r,q = (x+1).divmod(n)
#     r*m + [m - (n-q),0].max
# end

# ret = 0
# 1.upto(40) do |i|
#    b = g(B,i)
#    a = g(A-1,i)
#    if (b-a).odd?
#      ret += 1<<(i-1)
#    end
# end
# p ret