
def resolve():
    def f(x):
        res = x % 4
        if res == 0:
            return x
        elif res == 1:
            return 1
        elif res == 2:
            return x + 1
        else:
            return 0

    A, B = map(int, input().split())

    # 累積和の考えで [0, B] - [0, A-1]
    # 数列を4つ区切りでxorすると0になる
    # 0,1,2,3, -> 00, 01, 10, 11  = 0

    ans = f(B) ^ f(A - 1)
    print(ans)


if __name__ == "__main__":
    resolve() def resolve():
    def f(x):
        res = x % 4
        if res == 0:
            return x
        elif res == 1:
            return 1
        elif res == 2:
            return x + 1
        else:
            return 0

    A, B = map(int, input().split())

    # 累積和の考えで [0, B] - [0, A-1]
    # 数列を4つ区切りでxorすると0になる
    # 0,1,2,3, -> 00, 01, 10, 11  = 0

    ans = f(B) ^ f(A - 1)
    print(ans) resolve def f(x):
        res = x % 4
        if res == 0:
            return x
        elif res == 1:
            return 1
        elif res == 2:
            return x + 1
        else:
            return 0

     f res = x % 4 res x % 4 x 4 if res == 0:
            return x
        elif res == 1:
            return 1
        elif res == 2:
            return x + 1
        else:
            return 0

     res == 0 res 0 return x x elif res == 1:
            return 1
         res == 1 res 1 return 1 1 elif res == 2:
            return x + 1
         res == 2 res 2 return x + 1 x + 1 x 1 return 0 0 x x A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B ans = f(B) ^ f(A - 1) ans f(B) ^ f(A - 1) f(B) f B f(A - 1) f A - 1 A 1 print(ans) print ans if __name__ == "__main__":
    resolve() __name__ == "__main__" __name__ "__main__" resolve() resolve def resolve():
    def f(x):
        res = x % 4
        if res == 0:
            return x
        elif res == 1:
            return 1
        elif res == 2:
            return x + 1
        else:
            return 0

    A, B = map(int, input().split())

    # 累積和の考えで [0, B] - [0, A-1]
    # 数列を4つ区切りでxorすると0になる
    # 0,1,2,3, -> 00, 01, 10, 11  = 0

    ans = f(B) ^ f(A - 1)
    print(ans) def resolve():
    def f(x):
        res = x % 4
        if res == 0:
            return x
        elif res == 1:
            return 1
        elif res == 2:
            return x + 1
        else:
            return 0

    A, B = map(int, input().split())

    # 累積和の考えで [0, B] - [0, A-1]
    # 数列を4つ区切りでxorすると0になる
    # 0,1,2,3, -> 00, 01, 10, 11  = 0

    ans = f(B) ^ f(A - 1)
    print(ans) resolve

def resolve():
    def f(x):
        res = x % 4
        if res == 0:
            return x
        elif res == 1:
            return 1
        elif res == 2:
            return x + 1
        else:
            return 0

    A, B = map(int, input().split())

    # 累積和の考えで [0, B] - [0, A-1]
    # 数列を4つ区切りでxorすると0になる
    # 0,1,2,3, -> 00, 01, 10, 11  = 0

    ans = f(B) ^ f(A - 1)
    print(ans)


if __name__ == "__main__":
    resolve()