import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,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 operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

a,b=mii()

if a%2==0 and b%2==1:
    if ((b-a+1)//2)%2==0:
        print(0)
    else:
        print(1)

elif a%2==1 and b%2==1:
    if ((b-a)//2)%2==0:
        print(a^0)
    else:
        print(a^1)

elif a%2==1 and b%2==0:
    if ((b-a-1)//2)%2==0:
        print(a^b^0)
    else:
        print(a^b^1)

else:
    if ((b-a)//2)%2==0:
        print(b^0)
    else:
        print(b^1) import sys sys sys.setrecursionlimit(10**6) sys.setrecursionlimit sys setrecursionlimit 10**6 10 6 from math import floor,ceil,sqrt,factorial,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 operator import itemgetter from fractions import gcd mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 inf = float('inf') inf float('inf') float 'inf' ninf = -float('inf') ninf -float('inf') float('inf') float 'inf' def ii(): return int(sys.stdin.readline().rstrip()) #int(input()) ii def mii(): return map(int,sys.stdin.readline().rstrip().split()) mii def limii(): return list(mii()) #list(map(int,input().split())) limii ii() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) ii() ii def lin(n:int): return [ii() for _ in range(n)] lin n:int n limii() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) limii() limii def llint(n: int): return [limii() for _ in range(n)]
#文字列input llint n: int n def ss(): return sys.stdin.readline().rstrip() #input() ss def mss(): return sys.stdin.readline().rstrip().split() mss def limss(): return list(mss()) #list(input().split()) limss ss() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) ss() ss def lst(n:int): return [ss() for _ in range(n)] lst n:int n limss() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) limss() limss def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？ llstr n: int n a,b=mii() a mii() mii b if a%2==0 and b%2==1:
    if ((b-a+1)//2)%2==0:
        print(0)
    else:
        print(1)

elif a%2==1 and b%2==1:
    if ((b-a)//2)%2==0:
        print(a^0)
    else:
        print(a^1)

elif a%2==1 and b%2==0:
    if ((b-a-1)//2)%2==0:
        print(a^b^0)
    else:
        print(a^b^1)

else:
    if ((b-a)//2)%2==0:
        print(b^0)
    else:
        print(b^1) a%2==0 and b%2==1 a%2==0 a%2 a 2 0 b%2==1 b%2 b 2 1 if ((b-a+1)//2)%2==0:
        print(0)
    else:
        print(1) ((b-a+1)//2)%2==0 ((b-a+1)//2)%2 (b-a+1)//2 b-a+1 b-a b a 1 2 2 0 print(0) print 0 print(1) print 1 elif a%2==1 and b%2==1:
    if ((b-a)//2)%2==0:
        print(a^0)
    else:
        print(a^1) a%2==1 and b%2==1 a%2==1 a%2 a 2 1 b%2==1 b%2 b 2 1 if ((b-a)//2)%2==0:
        print(a^0)
    else:
        print(a^1) ((b-a)//2)%2==0 ((b-a)//2)%2 (b-a)//2 b-a b a 2 2 0 print(a^0) print a^0 a 0 print(a^1) print a^1 a 1 elif a%2==1 and b%2==0:
    if ((b-a-1)//2)%2==0:
        print(a^b^0)
    else:
        print(a^b^1) a%2==1 and b%2==0 a%2==1 a%2 a 2 1 b%2==0 b%2 b 2 0 if ((b-a-1)//2)%2==0:
        print(a^b^0)
    else:
        print(a^b^1) ((b-a-1)//2)%2==0 ((b-a-1)//2)%2 (b-a-1)//2 b-a-1 b-a b a 1 2 2 0 print(a^b^0) print a^b^0 a^b a b 0 print(a^b^1) print a^b^1 a^b a b 1 if ((b-a)//2)%2==0:
        print(b^0)
    else:
        print(b^1) ((b-a)//2)%2==0 ((b-a)//2)%2 (b-a)//2 b-a b a 2 2 0 print(b^0) print b^0 b 0 print(b^1) print b^1 b 1 def ii(): return int(sys.stdin.readline().rstrip()) #int(input()) def ii(): return int(sys.stdin.readline().rstrip()) #int(input()) ii def lin(n:int): return [ii() for _ in range(n)] def lin(n:int): return [ii() for _ in range(n)] lin a,b=mii() mii() a def limss(): return list(mss()) #list(input().split()) def limss(): return list(mss()) #list(input().split()) limss b=mii() mii() b def ss(): return sys.stdin.readline().rstrip() #input() def ss(): return sys.stdin.readline().rstrip() #input() ss def limii(): return list(mii()) #list(map(int,input().split())) def limii(): return list(mii()) #list(map(int,input().split())) limii def mss(): return sys.stdin.readline().rstrip().split() def mss(): return sys.stdin.readline().rstrip().split() mss mod = 10 ** 9 + 7 10 ** 9 + 7 mod def llint(n: int): return [limii() for _ in range(n)]
#文字列input def llint(n: int): return [limii() for _ in range(n)]
#文字列input llint ninf = -float('inf') -float('inf') ninf def lst(n:int): return [ss() for _ in range(n)] def lst(n:int): return [ss() for _ in range(n)] lst def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？ def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？ llstr inf = float('inf') float('inf') inf def mii(): return map(int,sys.stdin.readline().rstrip().split()) def mii(): return map(int,sys.stdin.readline().rstrip().split()) mii
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,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 operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

a,b=mii()

if a%2==0 and b%2==1:
    if ((b-a+1)//2)%2==0:
        print(0)
    else:
        print(1)

elif a%2==1 and b%2==1:
    if ((b-a)//2)%2==0:
        print(a^0)
    else:
        print(a^1)

elif a%2==1 and b%2==0:
    if ((b-a-1)//2)%2==0:
        print(a^b^0)
    else:
        print(a^b^1)

else:
    if ((b-a)//2)%2==0:
        print(b^0)
    else:
        print(b^1)