import sys
# sys.setrecursionlimit(100000)


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


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def f(n):
    res = 0
    if n == 0:
        return 0
    else:
        if n % 2 == 0:
            res = n
            n -= 1
        res = res ^ (((n + 1) // 2) % 2)
    return res


def main():
    a, b = input_int_list()
    # f(A,B) = f(0,a-1) XOR f(0,b)
    # n が偶数のとき、n XOR n+1 = 1

    if a == 0:
        print(f(b))
        return
    else:
        print(f(b) ^ f(a - 1))
    return


if __name__ == "__main__":
    main() import sys sys def input():
    return sys.stdin.readline().strip() input return sys.stdin.readline().strip() sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip def input_int():
    return int(input()) input_int return int(input()) int(input()) int input() input def input_int_list():
    return [int(i) for i in input().split()] input_int_list int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i return [int(i) for i in input().split()] [int(i) for i in input().split()] def f(n):
    res = 0
    if n == 0:
        return 0
    else:
        if n % 2 == 0:
            res = n
            n -= 1
        res = res ^ (((n + 1) // 2) % 2)
    return res f res = 0 res 0 if n == 0:
        return 0
    else:
        if n % 2 == 0:
            res = n
            n -= 1
        res = res ^ (((n + 1) // 2) % 2)
     n == 0 n 0 return 0 0 if n % 2 == 0:
            res = n
            n -= 1
         n % 2 == 0 n % 2 n 2 0 res = n res n n -= 1 n 1 res = res ^ (((n + 1) // 2) % 2) res res ^ (((n + 1) // 2) % 2) res ((n + 1) // 2) % 2 (n + 1) // 2 n + 1 n 1 2 2 return res res n n def main():
    a, b = input_int_list()
    # f(A,B) = f(0,a-1) XOR f(0,b)
    # n が偶数のとき、n XOR n+1 = 1

    if a == 0:
        print(f(b))
        return
    else:
        print(f(b) ^ f(a - 1))
    return main a, b = input_int_list() a input_int_list() input_int_list b if a == 0:
        print(f(b))
        return
    else:
        print(f(b) ^ f(a - 1))
     a == 0 a 0 print(f(b)) print f(b) f b return print(f(b) ^ f(a - 1)) print f(b) ^ f(a - 1) f(b) f b f(a - 1) f a - 1 a 1 return if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def f(n):
    res = 0
    if n == 0:
        return 0
    else:
        if n % 2 == 0:
            res = n
            n -= 1
        res = res ^ (((n + 1) // 2) % 2)
    return res def f(n):
    res = 0
    if n == 0:
        return 0
    else:
        if n % 2 == 0:
            res = n
            n -= 1
        res = res ^ (((n + 1) // 2) % 2)
    return res f def input_int_list():
    return [int(i) for i in input().split()] def input_int_list():
    return [int(i) for i in input().split()] input_int_list def input():
    return sys.stdin.readline().strip() def input():
    return sys.stdin.readline().strip() input def input_int():
    return int(input()) def input_int():
    return int(input()) input_int def main():
    a, b = input_int_list()
    # f(A,B) = f(0,a-1) XOR f(0,b)
    # n が偶数のとき、n XOR n+1 = 1

    if a == 0:
        print(f(b))
        return
    else:
        print(f(b) ^ f(a - 1))
    return def main():
    a, b = input_int_list()
    # f(A,B) = f(0,a-1) XOR f(0,b)
    # n が偶数のとき、n XOR n+1 = 1

    if a == 0:
        print(f(b))
        return
    else:
        print(f(b) ^ f(a - 1))
    return main
import sys
# sys.setrecursionlimit(100000)


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


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def f(n):
    res = 0
    if n == 0:
        return 0
    else:
        if n % 2 == 0:
            res = n
            n -= 1
        res = res ^ (((n + 1) // 2) % 2)
    return res


def main():
    a, b = input_int_list()
    # f(A,B) = f(0,a-1) XOR f(0,b)
    # n が偶数のとき、n XOR n+1 = 1

    if a == 0:
        print(f(b))
        return
    else:
        print(f(b) ^ f(a - 1))
    return


if __name__ == "__main__":
    main()
