#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def s(n):
        if n < 0:
            return 0
        m = n >> 2
        res = 0
        for i in range(m << 2,n+1):
            res ^= i
        return res
    a,b = LI()
    print(s(a-1)^s(b))
    return

#Solve
if __name__ == "__main__":
    solve() from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations, accumulate import sys sys import math math import bisect bisect int(x) for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() int(x) int x def LI(): return [int(x) for x in sys.stdin.readline().split()] LI def I(): return int(sys.stdin.readline()) I list(x) for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() list(x) list x def LS():return [list(x) for x in sys.stdin.readline().split()] LS def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res S res = list(sys.stdin.readline()) res list(sys.stdin.readline()) list sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline if res[-1] == "\n":
        return res[:-1]
     res[-1] == "\n" res[-1] res -1 "\n" return res[:-1] res[:-1] res :-1 -1 return res res def IR(n):
    return [I() for i in range(n)] IR I() for i in range(n) for i in range(n) i range(n) range n for i in range(n) I() I return [I() for i in range(n)] [I() for i in range(n)] n n def LIR(n):
    return [LI() for i in range(n)] LIR LI() for i in range(n) for i in range(n) i range(n) range n for i in range(n) LI() LI return [LI() for i in range(n)] [LI() for i in range(n)] n n def SR(n):
    return [S() for i in range(n)] SR S() for i in range(n) for i in range(n) i range(n) range n for i in range(n) S() S return [S() for i in range(n)] [S() for i in range(n)] n n def LSR(n):
    return [LS() for i in range(n)] LSR LS() for i in range(n) for i in range(n) i range(n) range n for i in range(n) LS() LS return [LS() for i in range(n)] [LS() for i in range(n)] n n sys.setrecursionlimit(1000000) sys.setrecursionlimit sys setrecursionlimit 1000000 mod = 1000000007 mod 1000000007 def solve():
    def s(n):
        if n < 0:
            return 0
        m = n >> 2
        res = 0
        for i in range(m << 2,n+1):
            res ^= i
        return res
    a,b = LI()
    print(s(a-1)^s(b))
    return

#Solve solve def s(n):
        if n < 0:
            return 0
        m = n >> 2
        res = 0
        for i in range(m << 2,n+1):
            res ^= i
        return res
     s if n < 0:
            return 0
         n < 0 n 0 return 0 0 m = n >> 2 m n >> 2 n 2 res = 0 res 0 for i in range(m << 2,n+1):
            res ^= i
         i range(m << 2,n+1) range m << 2 m 2 n+1 n 1 res ^= i res i return res res n n a,b = LI() a LI() LI b print(s(a-1)^s(b)) print s(a-1)^s(b) s(a-1) s a-1 a 1 s(b) s b return if __name__ == "__main__":
    solve() __name__ == "__main__" __name__ "__main__" solve() solve def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI(): return [int(x) for x in sys.stdin.readline().split()] LI def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res S def I(): return int(sys.stdin.readline()) def I(): return int(sys.stdin.readline()) I def SR(n):
    return [S() for i in range(n)] def SR(n):
    return [S() for i in range(n)] SR def solve():
    def s(n):
        if n < 0:
            return 0
        m = n >> 2
        res = 0
        for i in range(m << 2,n+1):
            res ^= i
        return res
    a,b = LI()
    print(s(a-1)^s(b))
    return

#Solve def solve():
    def s(n):
        if n < 0:
            return 0
        m = n >> 2
        res = 0
        for i in range(m << 2,n+1):
            res ^= i
        return res
    a,b = LI()
    print(s(a-1)^s(b))
    return

#Solve solve def LS():return [list(x) for x in sys.stdin.readline().split()] def LS():return [list(x) for x in sys.stdin.readline().split()] LS def LSR(n):
    return [LS() for i in range(n)] def LSR(n):
    return [LS() for i in range(n)] LSR mod = 1000000007 1000000007 mod def LIR(n):
    return [LI() for i in range(n)] def LIR(n):
    return [LI() for i in range(n)] LIR def IR(n):
    return [I() for i in range(n)] def IR(n):
    return [I() for i in range(n)] IR
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def s(n):
        if n < 0:
            return 0
        m = n >> 2
        res = 0
        for i in range(m << 2,n+1):
            res ^= i
        return res
    a,b = LI()
    print(s(a-1)^s(b))
    return

#Solve
if __name__ == "__main__":
    solve()
