def ascan; gets.split.map(&:to_i); end

a,b = ascan

# 0..x の排他的論理和
def solve(x)
    return 0 if x <= 0
    ans = ((x+1)/2)&1
    1.upto(55) do |i|
        l = 1 << i
        l2 = 1 << (i+1)
        # p [l2, x%l2, x%l2-l+1]
        ans += ([x%l2-l+1, 0].max&1) << i
    end
    ans
end

p solve(b) ^ solve(a-1)