from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

a, b = MAP()

def f(n):
    if n % 2 == 1:
        if ( (n+1)//2 ) % 2 == 1:
            return 1
        else:
            return 0
    else:
        if ( n//2 ) % 2 == 1:
            return n^1
        else:
            return n

ans = f(a-1)^f(b)
print(ans) from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement from collections import deque,defaultdict,Counter from bisect import bisect_left,bisect_right from operator import itemgetter from heapq import heapify,heappop,heappush from queue import Queue,LifoQueue,PriorityQueue from copy import deepcopy from time import time import string string import sys sys sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 def input() : return sys.stdin.readline().strip() input def INT()   : return int(input()) INT def MAP()   : return map(int,input().split()) MAP def LIST()  : return list(MAP()) LIST a, b = MAP() a MAP() MAP b def f(n):
    if n % 2 == 1:
        if ( (n+1)//2 ) % 2 == 1:
            return 1
        else:
            return 0
    else:
        if ( n//2 ) % 2 == 1:
            return n^1
        else:
            return n f if n % 2 == 1:
        if ( (n+1)//2 ) % 2 == 1:
            return 1
        else:
            return 0
    else:
        if ( n//2 ) % 2 == 1:
            return n^1
        else:
            return n n % 2 == 1 n % 2 n 2 1 if ( (n+1)//2 ) % 2 == 1:
            return 1
        else:
            return 0
     ( (n+1)//2 ) % 2 == 1 ( (n+1)//2 ) % 2 (n+1)//2 n+1 n 1 2 2 1 return 1 1 return 0 0 if ( n//2 ) % 2 == 1:
            return n^1
        else:
            return n ( n//2 ) % 2 == 1 ( n//2 ) % 2 n//2 n 2 2 1 return n^1 n^1 n 1 return n n n n ans = f(a-1)^f(b) ans f(a-1)^f(b) f(a-1) f a-1 a 1 f(b) f b print(ans) print ans b = MAP() MAP() b def LIST()  : return list(MAP()) def LIST()  : return list(MAP()) LIST def INT()   : return int(input()) def INT()   : return int(input()) INT ans = f(a-1)^f(b) f(a-1)^f(b) ans def MAP()   : return map(int,input().split()) def MAP()   : return map(int,input().split()) MAP def f(n):
    if n % 2 == 1:
        if ( (n+1)//2 ) % 2 == 1:
            return 1
        else:
            return 0
    else:
        if ( n//2 ) % 2 == 1:
            return n^1
        else:
            return n def f(n):
    if n % 2 == 1:
        if ( (n+1)//2 ) % 2 == 1:
            return 1
        else:
            return 0
    else:
        if ( n//2 ) % 2 == 1:
            return n^1
        else:
            return n f def input() : return sys.stdin.readline().strip() def input() : return sys.stdin.readline().strip() input a, b = MAP() MAP() a
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

a, b = MAP()

def f(n):
    if n % 2 == 1:
        if ( (n+1)//2 ) % 2 == 1:
            return 1
        else:
            return 0
    else:
        if ( n//2 ) % 2 == 1:
            return n^1
        else:
            return n

ans = f(a-1)^f(b)
print(ans)