def f(x):
    res = (x+1)//2%2
    
    for i in range(1, 50):
        n = x%2**(i+1)
        
        if n>=2**i and (n-2**i)%2==0:
            res += 2**i
    
    return res

A, B = map(int, input().split())

if A==0:
    print(f(B))
else:
    print(f(B)^f(A-1)) def f(x):
    res = (x+1)//2%2
    
    for i in range(1, 50):
        n = x%2**(i+1)
        
        if n>=2**i and (n-2**i)%2==0:
            res += 2**i
    
    return res f res = (x+1)//2%2 res (x+1)//2%2 (x+1)//2 x+1 x 1 2 2 for i in range(1, 50):
        n = x%2**(i+1)
        
        if n>=2**i and (n-2**i)%2==0:
            res += 2**i
    
     i range(1, 50) range 1 50 n = x%2**(i+1) n x%2**(i+1) x 2**(i+1) 2 i+1 i 1 if n>=2**i and (n-2**i)%2==0:
            res += 2**i
    
     n>=2**i and (n-2**i)%2==0 n>=2**i n 2**i 2 i (n-2**i)%2==0 (n-2**i)%2 n-2**i n 2**i 2 i 2 0 res += 2**i res 2**i 2 i return res res x x A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B if A==0:
    print(f(B))
else:
    print(f(B)^f(A-1)) A==0 A 0 print(f(B)) print f(B) f B print(f(B)^f(A-1)) print f(B)^f(A-1) f(B) f B f(A-1) f A-1 A 1 def f(x):
    res = (x+1)//2%2
    
    for i in range(1, 50):
        n = x%2**(i+1)
        
        if n>=2**i and (n-2**i)%2==0:
            res += 2**i
    
    return res def f(x):
    res = (x+1)//2%2
    
    for i in range(1, 50):
        n = x%2**(i+1)
        
        if n>=2**i and (n-2**i)%2==0:
            res += 2**i
    
    return res f B = map(int, input().split()) map(int, input().split()) B A, B = map(int, input().split()) map(int, input().split()) A
def f(x):
    res = (x+1)//2%2
    
    for i in range(1, 50):
        n = x%2**(i+1)
        
        if n>=2**i and (n-2**i)%2==0:
            res += 2**i
    
    return res

A, B = map(int, input().split())

if A==0:
    print(f(B))
else:
    print(f(B)^f(A-1))
