import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

A, B = mapint()

def cal(N):
    bits = [0]*50
    for i in range(1, 50):
        b = 2**i
        bits[i-1] = ((N//b*(b//2))+max(0, N%b-b//2))
    return bits

a_bits = cal(A)
b_bits = cal(B+1)
ans = 0
for i, (a, b) in enumerate(zip(a_bits, b_bits)):
    ans += 2**i*((a+b)%2)
print(ans) import sys sys def input(): return sys.stdin.readline().strip() input def mapint(): return map(int, input().split()) mapint sys.setrecursionlimit(10**9) sys.setrecursionlimit sys setrecursionlimit 10**9 10 9 A, B = mapint() A mapint() mapint B def cal(N):
    bits = [0]*50
    for i in range(1, 50):
        b = 2**i
        bits[i-1] = ((N//b*(b//2))+max(0, N%b-b//2))
    return bits cal bits = [0]*50 bits [0]*50 [0] 0 50 for i in range(1, 50):
        b = 2**i
        bits[i-1] = ((N//b*(b//2))+max(0, N%b-b//2))
     i range(1, 50) range 1 50 b = 2**i b 2**i 2 i bits[i-1] = ((N//b*(b//2))+max(0, N%b-b//2)) bits[i-1] bits i-1 i 1 (N//b*(b//2))+max(0, N%b-b//2) N//b*(b//2) N//b N b b//2 b 2 max(0, N%b-b//2) max 0 N%b-b//2 N%b N b b//2 b 2 return bits bits N N a_bits = cal(A) a_bits cal(A) cal A b_bits = cal(B+1) b_bits cal(B+1) cal B+1 B 1 ans = 0 ans 0 for i, (a, b) in enumerate(zip(a_bits, b_bits)):
    ans += 2**i*((a+b)%2) i (a, b) a b enumerate(zip(a_bits, b_bits)) enumerate zip(a_bits, b_bits) zip a_bits b_bits ans += 2**i*((a+b)%2) ans 2**i*((a+b)%2) 2**i 2 i (a+b)%2 a+b a b 2 print(ans) print ans def input(): return sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() input ans = 0 0 ans A, B = mapint() mapint() A b_bits = cal(B+1) cal(B+1) b_bits def mapint(): return map(int, input().split()) def mapint(): return map(int, input().split()) mapint B = mapint() mapint() B a_bits = cal(A) cal(A) a_bits def cal(N):
    bits = [0]*50
    for i in range(1, 50):
        b = 2**i
        bits[i-1] = ((N//b*(b//2))+max(0, N%b-b//2))
    return bits def cal(N):
    bits = [0]*50
    for i in range(1, 50):
        b = 2**i
        bits[i-1] = ((N//b*(b//2))+max(0, N%b-b//2))
    return bits cal ans += 2**i*((a+b)%2) 2**i*((a+b)%2) ans
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

A, B = mapint()

def cal(N):
    bits = [0]*50
    for i in range(1, 50):
        b = 2**i
        bits[i-1] = ((N//b*(b//2))+max(0, N%b-b//2))
    return bits

a_bits = cal(A)
b_bits = cal(B+1)
ans = 0
for i, (a, b) in enumerate(zip(a_bits, b_bits)):
    ans += 2**i*((a+b)%2)
print(ans)