def abc121_d():
    a, b = map(int, input().split())
    ans = 0
    if b - a < 8:
        for k in range(a, b+1):
            ans ^= k
    else:
        low = (a + 3) // 4
        up = b // 4
        for k in range(a, 4*low):
            ans ^= k
        for k in range(4*up, b+1):
            ans ^= k
    print(ans)

if __name__ == '__main__':
    abc121_d() def abc121_d():
    a, b = map(int, input().split())
    ans = 0
    if b - a < 8:
        for k in range(a, b+1):
            ans ^= k
    else:
        low = (a + 3) // 4
        up = b // 4
        for k in range(a, 4*low):
            ans ^= k
        for k in range(4*up, b+1):
            ans ^= k
    print(ans) abc121_d a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b ans = 0 ans 0 if b - a < 8:
        for k in range(a, b+1):
            ans ^= k
    else:
        low = (a + 3) // 4
        up = b // 4
        for k in range(a, 4*low):
            ans ^= k
        for k in range(4*up, b+1):
            ans ^= k
     b - a < 8 b - a b a 8 for k in range(a, b+1):
            ans ^= k
     k range(a, b+1) range a b+1 b 1 ans ^= k ans k low = (a + 3) // 4 low (a + 3) // 4 a + 3 a 3 4 up = b // 4 up b // 4 b 4 for k in range(a, 4*low):
            ans ^= k
         k range(a, 4*low) range a 4*low 4 low ans ^= k ans k for k in range(4*up, b+1):
            ans ^= k
     k range(4*up, b+1) range 4*up 4 up b+1 b 1 ans ^= k ans k print(ans) print ans if __name__ == '__main__':
    abc121_d() __name__ == '__main__' __name__ '__main__' abc121_d() abc121_d def abc121_d():
    a, b = map(int, input().split())
    ans = 0
    if b - a < 8:
        for k in range(a, b+1):
            ans ^= k
    else:
        low = (a + 3) // 4
        up = b // 4
        for k in range(a, 4*low):
            ans ^= k
        for k in range(4*up, b+1):
            ans ^= k
    print(ans) def abc121_d():
    a, b = map(int, input().split())
    ans = 0
    if b - a < 8:
        for k in range(a, b+1):
            ans ^= k
    else:
        low = (a + 3) // 4
        up = b // 4
        for k in range(a, 4*low):
            ans ^= k
        for k in range(4*up, b+1):
            ans ^= k
    print(ans) abc121_d
def abc121_d():
    a, b = map(int, input().split())
    ans = 0
    if b - a < 8:
        for k in range(a, b+1):
            ans ^= k
    else:
        low = (a + 3) // 4
        up = b // 4
        for k in range(a, 4*low):
            ans ^= k
        for k in range(4*up, b+1):
            ans ^= k
    print(ans)

if __name__ == '__main__':
    abc121_d()