import sys
def input(): return sys.stdin.readline().strip()

def f(a, n): # (1\xor 2\xor ...\xor a) のnビット目の値
    if a == 0: return 0
    if n == 0 and (a % 4 == 0 or a % 4 == 3): return 0
    if n == 0 and (a % 4 == 1 or a % 4 == 2): return 1
    idx = a // (2 ** n)
    if idx % 2 == 0: return 0
    return (a - idx * 2**n + 1) % 2

def g(a, b, n): # (a\xor a+1\xor...\xor b)のnビット目の値
    if a == 0: return f(b, n)
    return (f(b, n) + f(a-1, n)) % 2


def main():
    A, B = map(int, input().split())
    ans = 0
    for i in range(41):
        ans += g(A, B, i) * 2**i
        #print("i={}, 1-{}->{}, 1-{}->{} --> g={}".format(i, B, f(B, i), A-1, f(A-1, i), g(A, B, i)))
    print(ans)


if __name__ == "__main__":
    main() import sys sys def input(): return sys.stdin.readline().strip() input def f(a, n): # (1\xor 2\xor ...\xor a) のnビット目の値
    if a == 0: return 0
    if n == 0 and (a % 4 == 0 or a % 4 == 3): return 0
    if n == 0 and (a % 4 == 1 or a % 4 == 2): return 1
    idx = a // (2 ** n)
    if idx % 2 == 0: return 0
    return (a - idx * 2**n + 1) % 2 f if a == 0: return 0
     a == 0 a 0 if n == 0 and (a % 4 == 0 or a % 4 == 3): return 0
     n == 0 and (a % 4 == 0 or a % 4 == 3) n == 0 n 0 a % 4 == 0 or a % 4 == 3 a % 4 == 0 a % 4 a 4 0 a % 4 == 3 a % 4 a 4 3 if n == 0 and (a % 4 == 1 or a % 4 == 2): return 1
     n == 0 and (a % 4 == 1 or a % 4 == 2) n == 0 n 0 a % 4 == 1 or a % 4 == 2 a % 4 == 1 a % 4 a 4 1 a % 4 == 2 a % 4 a 4 2 idx = a // (2 ** n) idx a // (2 ** n) a 2 ** n 2 n if idx % 2 == 0: return 0
     idx % 2 == 0 idx % 2 idx 2 0 return (a - idx * 2**n + 1) % 2 (a - idx * 2**n + 1) % 2 a - idx * 2**n + 1 a - idx * 2**n a idx * 2**n idx 2**n 2 n 1 2 a a n n def g(a, b, n): # (a\xor a+1\xor...\xor b)のnビット目の値
    if a == 0: return f(b, n)
    return (f(b, n) + f(a-1, n)) % 2 g if a == 0: return f(b, n)
     a == 0 a 0 return (f(b, n) + f(a-1, n)) % 2 (f(b, n) + f(a-1, n)) % 2 f(b, n) + f(a-1, n) f(b, n) f b n f(a-1, n) f a-1 a 1 n 2 a a b b n n def main():
    A, B = map(int, input().split())
    ans = 0
    for i in range(41):
        ans += g(A, B, i) * 2**i
        #print("i={}, 1-{}->{}, 1-{}->{} --> g={}".format(i, B, f(B, i), A-1, f(A-1, i), g(A, B, i)))
    print(ans) main A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B ans = 0 ans 0 for i in range(41):
        ans += g(A, B, i) * 2**i
        #print("i={}, 1-{}->{}, 1-{}->{} --> g={}".format(i, B, f(B, i), A-1, f(A-1, i), g(A, B, i)))
     i range(41) range 41 ans += g(A, B, i) * 2**i ans g(A, B, i) * 2**i g(A, B, i) g A B i 2**i 2 i print(ans) print ans if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    A, B = map(int, input().split())
    ans = 0
    for i in range(41):
        ans += g(A, B, i) * 2**i
        #print("i={}, 1-{}->{}, 1-{}->{} --> g={}".format(i, B, f(B, i), A-1, f(A-1, i), g(A, B, i)))
    print(ans) def main():
    A, B = map(int, input().split())
    ans = 0
    for i in range(41):
        ans += g(A, B, i) * 2**i
        #print("i={}, 1-{}->{}, 1-{}->{} --> g={}".format(i, B, f(B, i), A-1, f(A-1, i), g(A, B, i)))
    print(ans) main def f(a, n): # (1\xor 2\xor ...\xor a) のnビット目の値
    if a == 0: return 0
    if n == 0 and (a % 4 == 0 or a % 4 == 3): return 0
    if n == 0 and (a % 4 == 1 or a % 4 == 2): return 1
    idx = a // (2 ** n)
    if idx % 2 == 0: return 0
    return (a - idx * 2**n + 1) % 2 def f(a, n): # (1\xor 2\xor ...\xor a) のnビット目の値
    if a == 0: return 0
    if n == 0 and (a % 4 == 0 or a % 4 == 3): return 0
    if n == 0 and (a % 4 == 1 or a % 4 == 2): return 1
    idx = a // (2 ** n)
    if idx % 2 == 0: return 0
    return (a - idx * 2**n + 1) % 2 f def input(): return sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() input def g(a, b, n): # (a\xor a+1\xor...\xor b)のnビット目の値
    if a == 0: return f(b, n)
    return (f(b, n) + f(a-1, n)) % 2 def g(a, b, n): # (a\xor a+1\xor...\xor b)のnビット目の値
    if a == 0: return f(b, n)
    return (f(b, n) + f(a-1, n)) % 2 g
import sys
def input(): return sys.stdin.readline().strip()

def f(a, n): # (1\xor 2\xor ...\xor a) のnビット目の値
    if a == 0: return 0
    if n == 0 and (a % 4 == 0 or a % 4 == 3): return 0
    if n == 0 and (a % 4 == 1 or a % 4 == 2): return 1
    idx = a // (2 ** n)
    if idx % 2 == 0: return 0
    return (a - idx * 2**n + 1) % 2

def g(a, b, n): # (a\xor a+1\xor...\xor b)のnビット目の値
    if a == 0: return f(b, n)
    return (f(b, n) + f(a-1, n)) % 2


def main():
    A, B = map(int, input().split())
    ans = 0
    for i in range(41):
        ans += g(A, B, i) * 2**i
        #print("i={}, 1-{}->{}, 1-{}->{} --> g={}".format(i, B, f(B, i), A-1, f(A-1, i), g(A, B, i)))
    print(ans)


if __name__ == "__main__":
    main()
