#create date: 2020-06-30 15:26

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    a, b = na()
    if b - a < 5:
        ans = 0
        for x in range(a, b+1):
            ans ^= x
        print(ans)
        quit()
    left, right = 0, 0
    if a % 4 == 0:
        left = 0
    else:
        for i in range(a % 4, 4):
            x = (a // 4) * 4 + i
            left ^= x
    if b % 4 == 0:
        right = b
    else:
        for i in range(0, b % 4+1):
            y = (b // 4) * 4 + i
            right ^= y
    print(left^right)

if __name__ == "__main__":
    main() import sys sys stdin = sys.stdin stdin sys.stdin sys stdin def ns(): return stdin.readline().rstrip() ns def ni(): return int(ns()) ni def na(): return list(map(int, stdin.readline().split())) na def main():
    a, b = na()
    if b - a < 5:
        ans = 0
        for x in range(a, b+1):
            ans ^= x
        print(ans)
        quit()
    left, right = 0, 0
    if a % 4 == 0:
        left = 0
    else:
        for i in range(a % 4, 4):
            x = (a // 4) * 4 + i
            left ^= x
    if b % 4 == 0:
        right = b
    else:
        for i in range(0, b % 4+1):
            y = (b // 4) * 4 + i
            right ^= y
    print(left^right) main a, b = na() a na() na b if b - a < 5:
        ans = 0
        for x in range(a, b+1):
            ans ^= x
        print(ans)
        quit()
     b - a < 5 b - a b a 5 ans = 0 ans 0 for x in range(a, b+1):
            ans ^= x
         x range(a, b+1) range a b+1 b 1 ans ^= x ans x print(ans) print ans quit() quit left, right = 0, 0 left 0 right 0 if a % 4 == 0:
        left = 0
    else:
        for i in range(a % 4, 4):
            x = (a // 4) * 4 + i
            left ^= x
     a % 4 == 0 a % 4 a 4 0 left = 0 left 0 for i in range(a % 4, 4):
            x = (a // 4) * 4 + i
            left ^= x
     i range(a % 4, 4) range a % 4 a 4 4 x = (a // 4) * 4 + i x (a // 4) * 4 + i (a // 4) * 4 a // 4 a 4 4 i left ^= x left x if b % 4 == 0:
        right = b
    else:
        for i in range(0, b % 4+1):
            y = (b // 4) * 4 + i
            right ^= y
     b % 4 == 0 b % 4 b 4 0 right = b right b for i in range(0, b % 4+1):
            y = (b // 4) * 4 + i
            right ^= y
     i range(0, b % 4+1) range 0 b % 4+1 b % 4 b 4 1 y = (b // 4) * 4 + i y (b // 4) * 4 + i (b // 4) * 4 b // 4 b 4 4 i right ^= y right y print(left^right) print left^right left right if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def ni(): return int(ns()) def ni(): return int(ns()) ni def na(): return list(map(int, stdin.readline().split())) def na(): return list(map(int, stdin.readline().split())) na stdin = sys.stdin sys.stdin stdin def ns(): return stdin.readline().rstrip() def ns(): return stdin.readline().rstrip() ns def main():
    a, b = na()
    if b - a < 5:
        ans = 0
        for x in range(a, b+1):
            ans ^= x
        print(ans)
        quit()
    left, right = 0, 0
    if a % 4 == 0:
        left = 0
    else:
        for i in range(a % 4, 4):
            x = (a // 4) * 4 + i
            left ^= x
    if b % 4 == 0:
        right = b
    else:
        for i in range(0, b % 4+1):
            y = (b // 4) * 4 + i
            right ^= y
    print(left^right) def main():
    a, b = na()
    if b - a < 5:
        ans = 0
        for x in range(a, b+1):
            ans ^= x
        print(ans)
        quit()
    left, right = 0, 0
    if a % 4 == 0:
        left = 0
    else:
        for i in range(a % 4, 4):
            x = (a // 4) * 4 + i
            left ^= x
    if b % 4 == 0:
        right = b
    else:
        for i in range(0, b % 4+1):
            y = (b // 4) * 4 + i
            right ^= y
    print(left^right) main
#create date: 2020-06-30 15:26

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    a, b = na()
    if b - a < 5:
        ans = 0
        for x in range(a, b+1):
            ans ^= x
        print(ans)
        quit()
    left, right = 0, 0
    if a % 4 == 0:
        left = 0
    else:
        for i in range(a % 4, 4):
            x = (a // 4) * 4 + i
            left ^= x
    if b % 4 == 0:
        right = b
    else:
        for i in range(0, b % 4+1):
            y = (b // 4) * 4 + i
            right ^= y
    print(left^right)

if __name__ == "__main__":
    main()