#!/usr/bin/env python3
import sys


def g(n: int):
    # 0 1 11 00 100 001 111 000 1000 0001 1011 0000 1100 0001 1111 0000
    # 0110
    # 0010
    # 00001010
    # 0000000010101010

    ans = 0
    ans += [0, 1, 1, 0][n % 4]
    for i in range(1, 64):
        k = n % 2 ** (i + 1)
        if k < 2 ** i:
            continue
        if k % 2 == 0:
            ans += 1 << i
    return ans


def solve(A: int, B: int):
    print(g(B) ^ g(A - 1))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)


if __name__ == '__main__':
    main() import sys sys def g(n: int):
    # 0 1 11 00 100 001 111 000 1000 0001 1011 0000 1100 0001 1111 0000
    # 0110
    # 0010
    # 00001010
    # 0000000010101010

    ans = 0
    ans += [0, 1, 1, 0][n % 4]
    for i in range(1, 64):
        k = n % 2 ** (i + 1)
        if k < 2 ** i:
            continue
        if k % 2 == 0:
            ans += 1 << i
    return ans g ans = 0 ans 0 ans += [0, 1, 1, 0][n % 4] ans [0, 1, 1, 0][n % 4] [0, 1, 1, 0] 0 1 1 0 n % 4 n 4 for i in range(1, 64):
        k = n % 2 ** (i + 1)
        if k < 2 ** i:
            continue
        if k % 2 == 0:
            ans += 1 << i
     i range(1, 64) range 1 64 k = n % 2 ** (i + 1) k n % 2 ** (i + 1) n 2 ** (i + 1) 2 i + 1 i 1 if k < 2 ** i:
            continue
         k < 2 ** i k 2 ** i 2 i continue if k % 2 == 0:
            ans += 1 << i
     k % 2 == 0 k % 2 k 2 0 ans += 1 << i ans 1 << i 1 i return ans ans n: int n def solve(A: int, B: int):
    print(g(B) ^ g(A - 1)) solve print(g(B) ^ g(A - 1)) print g(B) ^ g(A - 1) g(B) g B g(A - 1) g A - 1 A 1 A: int A B: int B def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B) main def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
     iterate_tokens for line in sys.stdin:
            for word in line.split():
                yield word
     line sys.stdin sys stdin for word in line.split():
                yield word
     word line.split() line.split line split yield word word tokens = iterate_tokens() tokens iterate_tokens() iterate_tokens A = int(next(tokens)) A int(next(tokens)) int next(tokens) next tokens B = int(next(tokens)) B int(next(tokens)) int next(tokens) next tokens solve(A, B) solve A B if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B) def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B) main def solve(A: int, B: int):
    print(g(B) ^ g(A - 1)) def solve(A: int, B: int):
    print(g(B) ^ g(A - 1)) solve def g(n: int):
    # 0 1 11 00 100 001 111 000 1000 0001 1011 0000 1100 0001 1111 0000
    # 0110
    # 0010
    # 00001010
    # 0000000010101010

    ans = 0
    ans += [0, 1, 1, 0][n % 4]
    for i in range(1, 64):
        k = n % 2 ** (i + 1)
        if k < 2 ** i:
            continue
        if k % 2 == 0:
            ans += 1 << i
    return ans def g(n: int):
    # 0 1 11 00 100 001 111 000 1000 0001 1011 0000 1100 0001 1111 0000
    # 0110
    # 0010
    # 00001010
    # 0000000010101010

    ans = 0
    ans += [0, 1, 1, 0][n % 4]
    for i in range(1, 64):
        k = n % 2 ** (i + 1)
        if k < 2 ** i:
            continue
        if k % 2 == 0:
            ans += 1 << i
    return ans g
#!/usr/bin/env python3
import sys


def g(n: int):
    # 0 1 11 00 100 001 111 000 1000 0001 1011 0000 1100 0001 1111 0000
    # 0110
    # 0010
    # 00001010
    # 0000000010101010

    ans = 0
    ans += [0, 1, 1, 0][n % 4]
    for i in range(1, 64):
        k = n % 2 ** (i + 1)
        if k < 2 ** i:
            continue
        if k % 2 == 0:
            ans += 1 << i
    return ans


def solve(A: int, B: int):
    print(g(B) ^ g(A - 1))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)


if __name__ == '__main__':
    main()
