import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    A, B = LI()

    # 実験した結果
    def f(x):
        rem = x % 4
        if rem == 0:
            return x
        elif rem == 1:
            return 1
        elif rem == 2:
            return x + 1
        elif rem == 3:
            return 0

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

if __name__ == '__main__':
    resolve() import bisect, collections, copy, heapq, itertools, math, string, sys bisect collections copy heapq itertools math string sys input = lambda: sys.stdin.readline().rstrip() input lambda: sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 INF = float('inf') INF float('inf') float 'inf' def I(): return int(input()) I def F(): return float(input()) F def SS(): return input() SS int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x def LI(): return [int(x) for x in input().split()] LI int(x)-1 for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x)-1 int(x) int x 1 def LI_(): return [int(x)-1 for x in input().split()] LI_ float(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() float(x) float x def LF(): return [float(x) for x in input().split()] LF def LSS(): return input().split() LSS def resolve():
    A, B = LI()

    # 実験した結果
    def f(x):
        rem = x % 4
        if rem == 0:
            return x
        elif rem == 1:
            return 1
        elif rem == 2:
            return x + 1
        elif rem == 3:
            return 0

    ans = f(B) ^ f(A - 1)
    print(ans) resolve A, B = LI() A LI() LI B def f(x):
        rem = x % 4
        if rem == 0:
            return x
        elif rem == 1:
            return 1
        elif rem == 2:
            return x + 1
        elif rem == 3:
            return 0

     f rem = x % 4 rem x % 4 x 4 if rem == 0:
            return x
        elif rem == 1:
            return 1
        elif rem == 2:
            return x + 1
        elif rem == 3:
            return 0

     rem == 0 rem 0 return x x elif rem == 1:
            return 1
         rem == 1 rem 1 return 1 1 elif rem == 2:
            return x + 1
         rem == 2 rem 2 return x + 1 x + 1 x 1 elif rem == 3:
            return 0

     rem == 3 rem 3 return 0 0 x x 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 SS(): return input() def SS(): return input() SS def I(): return int(input()) def I(): return int(input()) I def LI(): return [int(x) for x in input().split()] def LI(): return [int(x) for x in input().split()] LI def resolve():
    A, B = LI()

    # 実験した結果
    def f(x):
        rem = x % 4
        if rem == 0:
            return x
        elif rem == 1:
            return 1
        elif rem == 2:
            return x + 1
        elif rem == 3:
            return 0

    ans = f(B) ^ f(A - 1)
    print(ans) def resolve():
    A, B = LI()

    # 実験した結果
    def f(x):
        rem = x % 4
        if rem == 0:
            return x
        elif rem == 1:
            return 1
        elif rem == 2:
            return x + 1
        elif rem == 3:
            return 0

    ans = f(B) ^ f(A - 1)
    print(ans) resolve input = lambda: sys.stdin.readline().rstrip() lambda: sys.stdin.readline().rstrip() input def F(): return float(input()) def F(): return float(input()) F def LF(): return [float(x) for x in input().split()] def LF(): return [float(x) for x in input().split()] LF def LI_(): return [int(x)-1 for x in input().split()] def LI_(): return [int(x)-1 for x in input().split()] LI_ def LSS(): return input().split() def LSS(): return input().split() LSS INF = float('inf') float('inf') INF
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    A, B = LI()

    # 実験した結果
    def f(x):
        rem = x % 4
        if rem == 0:
            return x
        elif rem == 1:
            return 1
        elif rem == 2:
            return x + 1
        elif rem == 3:
            return 0

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

if __name__ == '__main__':
    resolve()
