import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
    A, B = NMI()
    C = [[0]*2 for _ in range(42)]
    B = B + 1
    for i in range(42):
        tmp = B - (B // (2**(i+1))) * 2**(i+1)
        if tmp < 2**i:
            C[i][0] = tmp + (B // (2**(i+1))) * 2**i
            C[i][1] = (B // (2 ** (i + 1))) * 2 ** i
        else:
            C[i][0] = 2**i + (B // (2**(i+1))) * 2**i
            C[i][1] = tmp - 2**i + (B // (2**(i+1))) * 2**i


    B = A
    for i in range(42):
        tmp = B - (B // (2**(i+1))) * 2**(i+1)
        if tmp < 2**i:
            C[i][0] -= tmp + (B // (2**(i+1))) * 2**i
            C[i][1] -= (B // (2 ** (i + 1))) * 2 ** i
        else:
            C[i][0] -= 2**i + (B // (2**(i+1))) * 2**i
            C[i][1] -= tmp - 2**i + (B // (2**(i+1))) * 2**i
    ans = 0
    for i in range(42):
        ans += C[i][1] % 2 * 2**i
    print(ans)


if __name__ == "__main__":
    main() import sys sys import math math from collections import deque sys.setrecursionlimit(1000000) sys.setrecursionlimit sys setrecursionlimit 1000000 MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 input = lambda: sys.stdin.readline().strip() input lambda: sys.stdin.readline().strip() sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip NI = lambda: int(input()) NI lambda: int(input()) int(input()) int input() input NMI = lambda: map(int, input().split()) NMI lambda: map(int, input().split()) map(int, input().split()) map int input().split() ().split () input split NLI = lambda: list(NMI()) NLI lambda: list(NMI()) list(NMI()) list NMI() NMI SI = lambda: input() SI lambda: input() input() input [int(num)] * w for _ in range(h) for _ in range(h) _ range(h) range h for _ in range(h) [int(num)] * w [int(num)] int(num) int num w def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)] make_grid h h w w num num def main():
    A, B = NMI()
    C = [[0]*2 for _ in range(42)]
    B = B + 1
    for i in range(42):
        tmp = B - (B // (2**(i+1))) * 2**(i+1)
        if tmp < 2**i:
            C[i][0] = tmp + (B // (2**(i+1))) * 2**i
            C[i][1] = (B // (2 ** (i + 1))) * 2 ** i
        else:
            C[i][0] = 2**i + (B // (2**(i+1))) * 2**i
            C[i][1] = tmp - 2**i + (B // (2**(i+1))) * 2**i


    B = A
    for i in range(42):
        tmp = B - (B // (2**(i+1))) * 2**(i+1)
        if tmp < 2**i:
            C[i][0] -= tmp + (B // (2**(i+1))) * 2**i
            C[i][1] -= (B // (2 ** (i + 1))) * 2 ** i
        else:
            C[i][0] -= 2**i + (B // (2**(i+1))) * 2**i
            C[i][1] -= tmp - 2**i + (B // (2**(i+1))) * 2**i
    ans = 0
    for i in range(42):
        ans += C[i][1] % 2 * 2**i
    print(ans) main A, B = NMI() A NMI() NMI B [0]*2 for _ in range(42) for _ in range(42) _ range(42) range 42 for _ in range(42) [0]*2 [0] 0 2 C = [[0]*2 for _ in range(42)] C [[0]*2 for _ in range(42)] B = B + 1 B B + 1 B 1 for i in range(42):
        tmp = B - (B // (2**(i+1))) * 2**(i+1)
        if tmp < 2**i:
            C[i][0] = tmp + (B // (2**(i+1))) * 2**i
            C[i][1] = (B // (2 ** (i + 1))) * 2 ** i
        else:
            C[i][0] = 2**i + (B // (2**(i+1))) * 2**i
            C[i][1] = tmp - 2**i + (B // (2**(i+1))) * 2**i


     i range(42) range 42 tmp = B - (B // (2**(i+1))) * 2**(i+1) tmp B - (B // (2**(i+1))) * 2**(i+1) B (B // (2**(i+1))) * 2**(i+1) B // (2**(i+1)) B 2**(i+1) 2 i+1 i 1 2**(i+1) 2 i+1 i 1 if tmp < 2**i:
            C[i][0] = tmp + (B // (2**(i+1))) * 2**i
            C[i][1] = (B // (2 ** (i + 1))) * 2 ** i
        else:
            C[i][0] = 2**i + (B // (2**(i+1))) * 2**i
            C[i][1] = tmp - 2**i + (B // (2**(i+1))) * 2**i


     tmp < 2**i tmp 2**i 2 i C[i][0] = tmp + (B // (2**(i+1))) * 2**i C[i][0] [i] C i 0 tmp + (B // (2**(i+1))) * 2**i tmp (B // (2**(i+1))) * 2**i B // (2**(i+1)) B 2**(i+1) 2 i+1 i 1 2**i 2 i C[i][1] = (B // (2 ** (i + 1))) * 2 ** i C[i][1] [i] C i 1 (B // (2 ** (i + 1))) * 2 ** i B // (2 ** (i + 1)) B 2 ** (i + 1) 2 i + 1 i 1 2 ** i 2 i C[i][0] = 2**i + (B // (2**(i+1))) * 2**i C[i][0] [i] C i 0 2**i + (B // (2**(i+1))) * 2**i 2**i 2 i (B // (2**(i+1))) * 2**i B // (2**(i+1)) B 2**(i+1) 2 i+1 i 1 2**i 2 i C[i][1] = tmp - 2**i + (B // (2**(i+1))) * 2**i C[i][1] [i] C i 1 tmp - 2**i + (B // (2**(i+1))) * 2**i tmp - 2**i tmp 2**i 2 i (B // (2**(i+1))) * 2**i B // (2**(i+1)) B 2**(i+1) 2 i+1 i 1 2**i 2 i B = A B A for i in range(42):
        tmp = B - (B // (2**(i+1))) * 2**(i+1)
        if tmp < 2**i:
            C[i][0] -= tmp + (B // (2**(i+1))) * 2**i
            C[i][1] -= (B // (2 ** (i + 1))) * 2 ** i
        else:
            C[i][0] -= 2**i + (B // (2**(i+1))) * 2**i
            C[i][1] -= tmp - 2**i + (B // (2**(i+1))) * 2**i
     i range(42) range 42 tmp = B - (B // (2**(i+1))) * 2**(i+1) tmp B - (B // (2**(i+1))) * 2**(i+1) B (B // (2**(i+1))) * 2**(i+1) B // (2**(i+1)) B 2**(i+1) 2 i+1 i 1 2**(i+1) 2 i+1 i 1 if tmp < 2**i:
            C[i][0] -= tmp + (B // (2**(i+1))) * 2**i
            C[i][1] -= (B // (2 ** (i + 1))) * 2 ** i
        else:
            C[i][0] -= 2**i + (B // (2**(i+1))) * 2**i
            C[i][1] -= tmp - 2**i + (B // (2**(i+1))) * 2**i
     tmp < 2**i tmp 2**i 2 i C[i][0] -= tmp + (B // (2**(i+1))) * 2**i C[i][0] [i] C i 0 tmp + (B // (2**(i+1))) * 2**i tmp (B // (2**(i+1))) * 2**i B // (2**(i+1)) B 2**(i+1) 2 i+1 i 1 2**i 2 i C[i][1] -= (B // (2 ** (i + 1))) * 2 ** i C[i][1] [i] C i 1 (B // (2 ** (i + 1))) * 2 ** i B // (2 ** (i + 1)) B 2 ** (i + 1) 2 i + 1 i 1 2 ** i 2 i C[i][0] -= 2**i + (B // (2**(i+1))) * 2**i C[i][0] [i] C i 0 2**i + (B // (2**(i+1))) * 2**i 2**i 2 i (B // (2**(i+1))) * 2**i B // (2**(i+1)) B 2**(i+1) 2 i+1 i 1 2**i 2 i C[i][1] -= tmp - 2**i + (B // (2**(i+1))) * 2**i C[i][1] [i] C i 1 tmp - 2**i + (B // (2**(i+1))) * 2**i tmp - 2**i tmp 2**i 2 i (B // (2**(i+1))) * 2**i B // (2**(i+1)) B 2**(i+1) 2 i+1 i 1 2**i 2 i ans = 0 ans 0 for i in range(42):
        ans += C[i][1] % 2 * 2**i
     i range(42) range 42 ans += C[i][1] % 2 * 2**i ans C[i][1] % 2 * 2**i C[i][1] % 2 C[i][1] [i] C i 1 2 2**i 2 i print(ans) print ans if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main SI = lambda: input() lambda: input() SI def main():
    A, B = NMI()
    C = [[0]*2 for _ in range(42)]
    B = B + 1
    for i in range(42):
        tmp = B - (B // (2**(i+1))) * 2**(i+1)
        if tmp < 2**i:
            C[i][0] = tmp + (B // (2**(i+1))) * 2**i
            C[i][1] = (B // (2 ** (i + 1))) * 2 ** i
        else:
            C[i][0] = 2**i + (B // (2**(i+1))) * 2**i
            C[i][1] = tmp - 2**i + (B // (2**(i+1))) * 2**i


    B = A
    for i in range(42):
        tmp = B - (B // (2**(i+1))) * 2**(i+1)
        if tmp < 2**i:
            C[i][0] -= tmp + (B // (2**(i+1))) * 2**i
            C[i][1] -= (B // (2 ** (i + 1))) * 2 ** i
        else:
            C[i][0] -= 2**i + (B // (2**(i+1))) * 2**i
            C[i][1] -= tmp - 2**i + (B // (2**(i+1))) * 2**i
    ans = 0
    for i in range(42):
        ans += C[i][1] % 2 * 2**i
    print(ans) def main():
    A, B = NMI()
    C = [[0]*2 for _ in range(42)]
    B = B + 1
    for i in range(42):
        tmp = B - (B // (2**(i+1))) * 2**(i+1)
        if tmp < 2**i:
            C[i][0] = tmp + (B // (2**(i+1))) * 2**i
            C[i][1] = (B // (2 ** (i + 1))) * 2 ** i
        else:
            C[i][0] = 2**i + (B // (2**(i+1))) * 2**i
            C[i][1] = tmp - 2**i + (B // (2**(i+1))) * 2**i


    B = A
    for i in range(42):
        tmp = B - (B // (2**(i+1))) * 2**(i+1)
        if tmp < 2**i:
            C[i][0] -= tmp + (B // (2**(i+1))) * 2**i
            C[i][1] -= (B // (2 ** (i + 1))) * 2 ** i
        else:
            C[i][0] -= 2**i + (B // (2**(i+1))) * 2**i
            C[i][1] -= tmp - 2**i + (B // (2**(i+1))) * 2**i
    ans = 0
    for i in range(42):
        ans += C[i][1] % 2 * 2**i
    print(ans) main NLI = lambda: list(NMI()) lambda: list(NMI()) NLI NI = lambda: int(input()) lambda: int(input()) NI NMI = lambda: map(int, input().split()) lambda: map(int, input().split()) NMI def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)] def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)] make_grid input = lambda: sys.stdin.readline().strip() lambda: sys.stdin.readline().strip() input MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
    A, B = NMI()
    C = [[0]*2 for _ in range(42)]
    B = B + 1
    for i in range(42):
        tmp = B - (B // (2**(i+1))) * 2**(i+1)
        if tmp < 2**i:
            C[i][0] = tmp + (B // (2**(i+1))) * 2**i
            C[i][1] = (B // (2 ** (i + 1))) * 2 ** i
        else:
            C[i][0] = 2**i + (B // (2**(i+1))) * 2**i
            C[i][1] = tmp - 2**i + (B // (2**(i+1))) * 2**i


    B = A
    for i in range(42):
        tmp = B - (B // (2**(i+1))) * 2**(i+1)
        if tmp < 2**i:
            C[i][0] -= tmp + (B // (2**(i+1))) * 2**i
            C[i][1] -= (B // (2 ** (i + 1))) * 2 ** i
        else:
            C[i][0] -= 2**i + (B // (2**(i+1))) * 2**i
            C[i][1] -= tmp - 2**i + (B // (2**(i+1))) * 2**i
    ans = 0
    for i in range(42):
        ans += C[i][1] % 2 * 2**i
    print(ans)


if __name__ == "__main__":
    main()