#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

a,b=MI()
def accumbi(x):
    ans=((x+1)//2)%2
    i=1
    while 2**(i-1)<x:
        ans+=(2**i)*((max(0,x%(2**(i+1))-2**i+1))%2)
        i+=1
    return ans
print(accumbi(b)^accumbi(a-1)) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 from collections import Counter, deque from collections import defaultdict from itertools import combinations, permutations, accumulate, groupby, product from bisect import bisect_left,bisect_right from heapq import heapify, heappop, heappush from math import floor, ceil,pi from operator import itemgetter def I(): return int(input()) I def MI(): return map(int, input().split()) MI def LI(): return list(map(int, input().split())) LI int(input()) for i in range(n) for i in range(n) i range(n) range n for i in range(n) int(input()) int input() input def LI2(): return [int(input()) for i in range(n)] LI2 [LI()]for i in range(n) for i in range(n) i range(n) range n for i in range(n) [LI()] LI() LI def MXI(): return [[LI()]for i in range(n)] MXI def SI(): return input().rstrip() SI def printns(x): print('\n'.join(x)) printns x x def printni(x): print('\n'.join(list(map(str,x)))) printni x x inf = 10**17 inf 10**17 10 17 mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 a,b=MI() a MI() MI b def accumbi(x):
    ans=((x+1)//2)%2
    i=1
    while 2**(i-1)<x:
        ans+=(2**i)*((max(0,x%(2**(i+1))-2**i+1))%2)
        i+=1
    return ans accumbi ans=((x+1)//2)%2 ans ((x+1)//2)%2 (x+1)//2 x+1 x 1 2 2 i=1 i 1 while 2**(i-1)<x:
        ans+=(2**i)*((max(0,x%(2**(i+1))-2**i+1))%2)
        i+=1
     2**(i-1)<x 2**(i-1) 2 i-1 i 1 x ans+=(2**i)*((max(0,x%(2**(i+1))-2**i+1))%2) ans (2**i)*((max(0,x%(2**(i+1))-2**i+1))%2) 2**i 2 i (max(0,x%(2**(i+1))-2**i+1))%2 max(0,x%(2**(i+1))-2**i+1) max 0 x%(2**(i+1))-2**i+1 x%(2**(i+1))-2**i x%(2**(i+1)) x 2**(i+1) 2 i+1 i 1 2**i 2 i 1 2 i+=1 i 1 return ans ans x x print(accumbi(b)^accumbi(a-1)) print accumbi(b)^accumbi(a-1) accumbi(b) accumbi b accumbi(a-1) accumbi a-1 a 1 def accumbi(x):
    ans=((x+1)//2)%2
    i=1
    while 2**(i-1)<x:
        ans+=(2**i)*((max(0,x%(2**(i+1))-2**i+1))%2)
        i+=1
    return ans def accumbi(x):
    ans=((x+1)//2)%2
    i=1
    while 2**(i-1)<x:
        ans+=(2**i)*((max(0,x%(2**(i+1))-2**i+1))%2)
        i+=1
    return ans accumbi def MI(): return map(int, input().split()) def MI(): return map(int, input().split()) MI def LI2(): return [int(input()) for i in range(n)] def LI2(): return [int(input()) for i in range(n)] LI2 def printns(x): print('\n'.join(x)) def printns(x): print('\n'.join(x)) printns b=MI() MI() b def MXI(): return [[LI()]for i in range(n)] def MXI(): return [[LI()]for i in range(n)] MXI def printni(x): print('\n'.join(list(map(str,x)))) def printni(x): print('\n'.join(list(map(str,x)))) printni input = sys.stdin.readline sys.stdin.readline input def LI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) LI mod = 10**9 + 7 10**9 + 7 mod a,b=MI() MI() a def I(): return int(input()) def I(): return int(input()) I inf = 10**17 10**17 inf def SI(): return input().rstrip() def SI(): return input().rstrip() SI
#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

a,b=MI()
def accumbi(x):
    ans=((x+1)//2)%2
    i=1
    while 2**(i-1)<x:
        ans+=(2**i)*((max(0,x%(2**(i+1))-2**i+1))%2)
        i+=1
    return ans
print(accumbi(b)^accumbi(a-1))