def resolve():
    A, B = list(map(int, input().split()))
    ans = A
    i = A + 1
    warped = False
    while i <= B:
        if not warped and i % 4 == 0:
            i = B - B%4
            warped = True
        else:
            ans = ans ^ i
            i += 1
    print(ans)

if '__main__' == __name__:
    resolve() def resolve():
    A, B = list(map(int, input().split()))
    ans = A
    i = A + 1
    warped = False
    while i <= B:
        if not warped and i % 4 == 0:
            i = B - B%4
            warped = True
        else:
            ans = ans ^ i
            i += 1
    print(ans) resolve A, B = list(map(int, input().split())) A list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split B ans = A ans A i = A + 1 i A + 1 A 1 warped = False warped False while i <= B:
        if not warped and i % 4 == 0:
            i = B - B%4
            warped = True
        else:
            ans = ans ^ i
            i += 1
     i <= B i B if not warped and i % 4 == 0:
            i = B - B%4
            warped = True
        else:
            ans = ans ^ i
            i += 1
     not warped and i % 4 == 0 not warped warped i % 4 == 0 i % 4 i 4 0 i = B - B%4 i B - B%4 B B%4 B 4 warped = True warped True ans = ans ^ i ans ans ^ i ans i i += 1 i 1 print(ans) print ans if '__main__' == __name__:
    resolve() '__main__' == __name__ '__main__' __name__ resolve() resolve def resolve():
    A, B = list(map(int, input().split()))
    ans = A
    i = A + 1
    warped = False
    while i <= B:
        if not warped and i % 4 == 0:
            i = B - B%4
            warped = True
        else:
            ans = ans ^ i
            i += 1
    print(ans) def resolve():
    A, B = list(map(int, input().split()))
    ans = A
    i = A + 1
    warped = False
    while i <= B:
        if not warped and i % 4 == 0:
            i = B - B%4
            warped = True
        else:
            ans = ans ^ i
            i += 1
    print(ans) resolve
def resolve():
    A, B = list(map(int, input().split()))
    ans = A
    i = A + 1
    warped = False
    while i <= B:
        if not warped and i % 4 == 0:
            i = B - B%4
            warped = True
        else:
            ans = ans ^ i
            i += 1
    print(ans)

if '__main__' == __name__:
    resolve()