#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def f(x):
    res = 0
    while(((x+1)%4)!=0):
        res ^= x
        x-=1

    return res
def main():
    A,B=MI()
    print(f(B)^f(A-1))

if __name__ == '__main__':
    main() import sys sys sys.setrecursionlimit(10**6) sys.setrecursionlimit sys setrecursionlimit 10**6 10 6 input=sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline from math import floor,sqrt,factorial,hypot,log from heapq import heappop, heappush, heappushpop from collections import Counter,defaultdict,deque from itertools import accumulate,permutations,combinations,product,combinations_with_replacement from bisect import bisect_left,bisect_right from copy import deepcopy from fractions import gcd from random import randint def ceil(a,b): return (a+b-1)//b ceil a a b b inf=float('inf') inf float('inf') float 'inf' mod = 10**9+7 mod 10**9+7 10**9 10 9 7 def pprint(*A): 
    for a in A:     print(*a,sep='\n') pprint for a in A:     print(*a,sep=' a A *A def INT_(n): return int(n)-1 INT_ n n def MI(): return map(int,input().split()) MI def MF(): return map(float, input().split()) MF def MI_(): return map(INT_,input().split()) MI_ def LI(): return list(MI()) 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_ def LF(): return list(MF()) LF I() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) I() I def LIN(n:int): return [I() for _ in range(n)] LIN n:int n LI() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) LI() LI def LLIN(n: int): return [LI() for _ in range(n)] LLIN n: int n LI_() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) LI_() LI_ def LLIN_(n: int): return [LI_() for _ in range(n)] LLIN_ n: int n list(map(int, l.split() )) for l in input() for l in input() l input() input for l in input() list(map(int, l.split() )) list map(int, l.split() ) map int l.split() l.split l split def LLI(): return [list(map(int, l.split() )) for l in input()] LLI def I(): return int(input()) I def F(): return float(input()) F def ST(): return input().replace('\n', '') ST def f(x):
    res = 0
    while(((x+1)%4)!=0):
        res ^= x
        x-=1

    return res f res = 0 res 0 while(((x+1)%4)!=0):
        res ^= x
        x-=1

     ((x+1)%4)!=0 (x+1)%4 x+1 x 1 4 0 res ^= x res x x-=1 x 1 return res res x x def main():
    A,B=MI()
    print(f(B)^f(A-1)) main A,B=MI() A MI() MI B print(f(B)^f(A-1)) print f(B)^f(A-1) f(B) f B f(A-1) f A-1 A 1 if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def LLI(): return [list(map(int, l.split() )) for l in input()] def LLI(): return [list(map(int, l.split() )) for l in input()] LLI def LLIN(n: int): return [LI() for _ in range(n)] def LLIN(n: int): return [LI() for _ in range(n)] LLIN def INT_(n): return int(n)-1 def INT_(n): return int(n)-1 INT_ def ST(): return input().replace('\n', '') def ST(): return input().replace('\n', '') ST def pprint(*A): 
    for a in A:     print(*a,sep='\n') def pprint(*A): 
    for a in A:     print(*a,sep='\n') pprint def LLIN_(n: int): return [LI_() for _ in range(n)] def LLIN_(n: int): return [LI_() for _ in range(n)] LLIN_ input=sys.stdin.readline sys.stdin.readline input def LI_(): return [int(x) - 1 for x in input().split()] def LI_(): return [int(x) - 1 for x in input().split()] LI_ def F(): return float(input()) def F(): return float(input()) F def MF(): return map(float, input().split()) def MF(): return map(float, input().split()) MF inf=float('inf') float('inf') inf def f(x):
    res = 0
    while(((x+1)%4)!=0):
        res ^= x
        x-=1

    return res def f(x):
    res = 0
    while(((x+1)%4)!=0):
        res ^= x
        x-=1

    return res f mod = 10**9+7 10**9+7 mod def MI(): return map(int,input().split()) def MI(): return map(int,input().split()) MI def LF(): return list(MF()) def LF(): return list(MF()) LF def I(): return int(input()) def I(): return int(input()) I def MI_(): return map(INT_,input().split()) def MI_(): return map(INT_,input().split()) MI_ def LIN(n:int): return [I() for _ in range(n)] def LIN(n:int): return [I() for _ in range(n)] LIN def ceil(a,b): return (a+b-1)//b def ceil(a,b): return (a+b-1)//b ceil def main():
    A,B=MI()
    print(f(B)^f(A-1)) def main():
    A,B=MI()
    print(f(B)^f(A-1)) main def LI(): return list(MI()) def LI(): return list(MI()) LI
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def f(x):
    res = 0
    while(((x+1)%4)!=0):
        res ^= x
        x-=1

    return res
def main():
    A,B=MI()
    print(f(B)^f(A-1))

if __name__ == '__main__':
    main()