def F(A, B):
    tmp = A
    for i in range(A, B):
        tmp = tmp^(i+1)
    return tmp

def f(A):
    tmp = A%4
    if tmp == 0:
        ans = 0^A
    elif tmp == 1:
        ans = 1
    elif tmp == 2:
        ans = 1^A
    else:
        ans = 0
    return ans

def main():
    A, B = map(int, input().split())
    #print(F(A, B))
    ans = f(B)^f(A-1)
    print(ans)

if __name__ == "__main__":
    main() def F(A, B):
    tmp = A
    for i in range(A, B):
        tmp = tmp^(i+1)
    return tmp F tmp = A tmp A for i in range(A, B):
        tmp = tmp^(i+1)
     i range(A, B) range A B tmp = tmp^(i+1) tmp tmp^(i+1) tmp i+1 i 1 return tmp tmp A A B B def f(A):
    tmp = A%4
    if tmp == 0:
        ans = 0^A
    elif tmp == 1:
        ans = 1
    elif tmp == 2:
        ans = 1^A
    else:
        ans = 0
    return ans f tmp = A%4 tmp A%4 A 4 if tmp == 0:
        ans = 0^A
    elif tmp == 1:
        ans = 1
    elif tmp == 2:
        ans = 1^A
    else:
        ans = 0
     tmp == 0 tmp 0 ans = 0^A ans 0^A 0 A elif tmp == 1:
        ans = 1
     tmp == 1 tmp 1 ans = 1 ans 1 elif tmp == 2:
        ans = 1^A
     tmp == 2 tmp 2 ans = 1^A ans 1^A 1 A ans = 0 ans 0 return ans ans A A def main():
    A, B = map(int, input().split())
    #print(F(A, B))
    ans = f(B)^f(A-1)
    print(ans) main 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__":
    main() __name__ == "__main__" __name__ "__main__" main() main def F(A, B):
    tmp = A
    for i in range(A, B):
        tmp = tmp^(i+1)
    return tmp def F(A, B):
    tmp = A
    for i in range(A, B):
        tmp = tmp^(i+1)
    return tmp F def f(A):
    tmp = A%4
    if tmp == 0:
        ans = 0^A
    elif tmp == 1:
        ans = 1
    elif tmp == 2:
        ans = 1^A
    else:
        ans = 0
    return ans def f(A):
    tmp = A%4
    if tmp == 0:
        ans = 0^A
    elif tmp == 1:
        ans = 1
    elif tmp == 2:
        ans = 1^A
    else:
        ans = 0
    return ans f def main():
    A, B = map(int, input().split())
    #print(F(A, B))
    ans = f(B)^f(A-1)
    print(ans) def main():
    A, B = map(int, input().split())
    #print(F(A, B))
    ans = f(B)^f(A-1)
    print(ans) main
def F(A, B):
    tmp = A
    for i in range(A, B):
        tmp = tmp^(i+1)
    return tmp

def f(A):
    tmp = A%4
    if tmp == 0:
        ans = 0^A
    elif tmp == 1:
        ans = 1
    elif tmp == 2:
        ans = 1^A
    else:
        ans = 0
    return ans

def main():
    A, B = map(int, input().split())
    #print(F(A, B))
    ans = f(B)^f(A-1)
    print(ans)

if __name__ == "__main__":
    main()
