import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# https://atcoder.jp/contests/abc121/tasks/abc121_d

# xorとは繰り上がりのない足し算である

# f(A,B)=f(0,B)-f(0,A-1)
# f(0,i)をどうやって高速に求めるか？
# 各桁独立、ibit目に登場した1の数の偶奇でわかる
# しかも4つごとに周期が存在する(4*n -1 のときはかならず0になるのでこれを利用できる)


def f(x):
    start = x // 4 * 4
    ret = 0
    for i in ra(start, x + 1):
        ret ^= i
    return ret


A, B = read_ints()
# print(f(B), f(A - 1))
print(f(B) ^ f(A - 1)) import sys sys sys.setrecursionlimit(1 << 25) sys.setrecursionlimit sys setrecursionlimit 1 << 25 1 25 read = sys.stdin.readline read sys.stdin.readline sys.stdin sys stdin readline ra = range ra range enu = enumerate enu enumerate def read_ints():
    return list(map(int, read().split())) read_ints return list(map(int, read().split())) list(map(int, read().split())) list map(int, read().split()) map int read().split() ().split () read split def read_a_int():
    return int(read()) read_a_int return int(read()) int(read()) int read() read def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret read_tuple '''
    H is number of rows
    ''' ret = [] ret [] for _ in range(H):
        ret.append(tuple(map(int, read().split())))
     _ range(H) range H ret.append(tuple(map(int, read().split()))) ret.append ret append tuple(map(int, read().split())) tuple map(int, read().split()) map int read().split() ().split () read split return ret ret H H def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret))) read_col '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    ''' ret = [] ret [] for _ in range(H):
        ret.append(list(map(int, read().split())))
     _ range(H) range H ret.append(list(map(int, read().split()))) ret.append ret append list(map(int, read().split())) list map(int, read().split()) map int read().split() ().split () read split return tuple(map(list, zip(*ret))) tuple(map(list, zip(*ret))) tuple map(list, zip(*ret)) map list zip(*ret) zip *ret ret H H def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため read_matrix '''
    H is number of rows
    ''' ret = [] ret [] for _ in range(H):
        ret.append(list(map(int, read().split())))
     _ range(H) range H ret.append(list(map(int, read().split()))) ret.append ret append list(map(int, read().split())) list map(int, read().split()) map int read().split() ().split () read split return ret ret H H MOD = 10**9 + 7 MOD 10**9 + 7 10**9 10 9 7 INF = 2**31 INF 2**31 2 31 from collections import defaultdict, Counter, deque from operator import itemgetter from itertools import product, permutations, combinations from bisect import bisect_left, bisect_right def f(x):
    start = x // 4 * 4
    ret = 0
    for i in ra(start, x + 1):
        ret ^= i
    return ret f start = x // 4 * 4 start x // 4 * 4 x // 4 x 4 4 ret = 0 ret 0 for i in ra(start, x + 1):
        ret ^= i
     i ra(start, x + 1) ra start x + 1 x 1 ret ^= i ret i return ret ret x x A, B = read_ints() A read_ints() read_ints 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 def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため read_matrix def f(x):
    start = x // 4 * 4
    ret = 0
    for i in ra(start, x + 1):
        ret ^= i
    return ret def f(x):
    start = x // 4 * 4
    ret = 0
    for i in ra(start, x + 1):
        ret ^= i
    return ret f ra = range range ra enu = enumerate enumerate enu def read_a_int():
    return int(read()) def read_a_int():
    return int(read()) read_a_int B = read_ints() read_ints() B def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret read_tuple def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret))) def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret))) read_col A, B = read_ints() read_ints() A read = sys.stdin.readline sys.stdin.readline read INF = 2**31 2**31 INF def read_ints():
    return list(map(int, read().split())) def read_ints():
    return list(map(int, read().split())) read_ints MOD = 10**9 + 7 10**9 + 7 MOD
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# https://atcoder.jp/contests/abc121/tasks/abc121_d

# xorとは繰り上がりのない足し算である

# f(A,B)=f(0,B)-f(0,A-1)
# f(0,i)をどうやって高速に求めるか？
# 各桁独立、ibit目に登場した1の数の偶奇でわかる
# しかも4つごとに周期が存在する(4*n -1 のときはかならず0になるのでこれを利用できる)


def f(x):
    start = x // 4 * 4
    ret = 0
    for i in ra(start, x + 1):
        ret ^= i
    return ret


A, B = read_ints()
# print(f(B), f(A - 1))
print(f(B) ^ f(A - 1))
