import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A, B = map(int, readline().split())

    def rec(x):
        if x < 4:
            ans = 0
            for i in range(1, x + 1):
                ans ^= i
            return ans

        p = 0
        y = 1
        while y << 1 <= x:
            y <<= 1
            p += 1

        return (1 << p) * ((x - y + 1) % 2) + rec(x & ~(1 << p))

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


if __name__ == '__main__':
    main() import sys sys read = sys.stdin.read read sys.stdin.read sys.stdin sys stdin read readline = sys.stdin.readline readline sys.stdin.readline sys.stdin sys stdin readline readlines = sys.stdin.readlines readlines sys.stdin.readlines sys.stdin sys stdin readlines sys.setrecursionlimit(10 ** 9) sys.setrecursionlimit sys setrecursionlimit 10 ** 9 10 9 INF = 1 << 60 INF 1 << 60 1 60 MOD = 1000000007 MOD 1000000007 def main():
    A, B = map(int, readline().split())

    def rec(x):
        if x < 4:
            ans = 0
            for i in range(1, x + 1):
                ans ^= i
            return ans

        p = 0
        y = 1
        while y << 1 <= x:
            y <<= 1
            p += 1

        return (1 << p) * ((x - y + 1) % 2) + rec(x & ~(1 << p))

    if A == 0:
        print(rec(B))
    else:
        print(rec(B) ^ rec(A - 1))
    return main A, B = map(int, readline().split()) A map(int, readline().split()) map int readline().split() ().split () readline split B def rec(x):
        if x < 4:
            ans = 0
            for i in range(1, x + 1):
                ans ^= i
            return ans

        p = 0
        y = 1
        while y << 1 <= x:
            y <<= 1
            p += 1

        return (1 << p) * ((x - y + 1) % 2) + rec(x & ~(1 << p))

     rec if x < 4:
            ans = 0
            for i in range(1, x + 1):
                ans ^= i
            return ans

         x < 4 x 4 ans = 0 ans 0 for i in range(1, x + 1):
                ans ^= i
             i range(1, x + 1) range 1 x + 1 x 1 ans ^= i ans i return ans ans p = 0 p 0 y = 1 y 1 while y << 1 <= x:
            y <<= 1
            p += 1

         y << 1 <= x y << 1 y 1 x y <<= 1 y 1 p += 1 p 1 return (1 << p) * ((x - y + 1) % 2) + rec(x & ~(1 << p)) (1 << p) * ((x - y + 1) % 2) + rec(x & ~(1 << p)) (1 << p) * ((x - y + 1) % 2) 1 << p 1 p (x - y + 1) % 2 x - y + 1 x - y x y 1 2 rec(x & ~(1 << p)) rec x & ~(1 << p) x ~(1 << p) 1 << p 1 p x x if A == 0:
        print(rec(B))
    else:
        print(rec(B) ^ rec(A - 1))
     A == 0 A 0 print(rec(B)) print rec(B) rec B print(rec(B) ^ rec(A - 1)) print rec(B) ^ rec(A - 1) rec(B) rec B rec(A - 1) rec A - 1 A 1 return if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main read = sys.stdin.read sys.stdin.read read INF = 1 << 60 1 << 60 INF MOD = 1000000007 1000000007 MOD readline = sys.stdin.readline sys.stdin.readline readline readlines = sys.stdin.readlines sys.stdin.readlines readlines def main():
    A, B = map(int, readline().split())

    def rec(x):
        if x < 4:
            ans = 0
            for i in range(1, x + 1):
                ans ^= i
            return ans

        p = 0
        y = 1
        while y << 1 <= x:
            y <<= 1
            p += 1

        return (1 << p) * ((x - y + 1) % 2) + rec(x & ~(1 << p))

    if A == 0:
        print(rec(B))
    else:
        print(rec(B) ^ rec(A - 1))
    return def main():
    A, B = map(int, readline().split())

    def rec(x):
        if x < 4:
            ans = 0
            for i in range(1, x + 1):
                ans ^= i
            return ans

        p = 0
        y = 1
        while y << 1 <= x:
            y <<= 1
            p += 1

        return (1 << p) * ((x - y + 1) % 2) + rec(x & ~(1 << p))

    if A == 0:
        print(rec(B))
    else:
        print(rec(B) ^ rec(A - 1))
    return main
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A, B = map(int, readline().split())

    def rec(x):
        if x < 4:
            ans = 0
            for i in range(1, x + 1):
                ans ^= i
            return ans

        p = 0
        y = 1
        while y << 1 <= x:
            y <<= 1
            p += 1

        return (1 << p) * ((x - y + 1) % 2) + rec(x & ~(1 << p))

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


if __name__ == '__main__':
    main()
