def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

A, B = getNM()
# bit1桁目のフラグの個数
# 周期は2 ** 1
# 0と1が交互に
# bit2桁目のフラグの個数
# 周期は2 ** 2
flags1 = [0] * 61
flags2 = [0] * 61
# 1 ~ nまでに各桁のフラグが何本立つか計算する関数
def bitflag(n, flaglist):
    if n > 0:
        for i in range(1, 61):
            split = 2 ** i
            flag1 = (n // split) * (split // 2)
            flag2 = max(n % split + 1 - (split // 2), 0)
            flaglist[i] += flag1 + flag2
# 1 ~ A - 1について（Aは範囲に入っているため）
bitflag(A - 1, flags1)
bitflag(B, flags2)
for i in range(61):
    flags2[i] -= flags1[i]
ans = 0
# 奇数ならフラグが立つ
for i in range(61):
    if flags2[i] % 2 != 0:
        ans += 2 ** (i - 1)
print(ans) def getN():
    return int(input()) getN return int(input()) int(input()) int input() input def getNM():
    return map(int, input().split()) getNM return map(int, input().split()) map(int, input().split()) map int input().split() ().split () input split def getList():
    return list(map(int, input().split())) getList return list(map(int, input().split())) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split def getArray(intn):
    return [int(input()) for i in range(intn)] getArray int(input()) for i in range(intn) for i in range(intn) i range(intn) range intn for i in range(intn) int(input()) int input() input return [int(input()) for i in range(intn)] [int(input()) for i in range(intn)] intn intn def input():
    return sys.stdin.readline().rstrip() input return sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip from collections import defaultdict, deque, Counter from sys import exit import heapq heapq import math math import copy copy from operator import mul from functools import reduce from bisect import bisect_left, bisect_right import sys sys sys.setrecursionlimit(1000000000) sys.setrecursionlimit sys setrecursionlimit 1000000000 mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 A, B = getNM() A getNM() getNM B flags1 = [0] * 61 flags1 [0] * 61 [0] 0 61 flags2 = [0] * 61 flags2 [0] * 61 [0] 0 61 def bitflag(n, flaglist):
    if n > 0:
        for i in range(1, 61):
            split = 2 ** i
            flag1 = (n // split) * (split // 2)
            flag2 = max(n % split + 1 - (split // 2), 0)
            flaglist[i] += flag1 + flag2
# 1 ~ A - 1について（Aは範囲に入っているため） bitflag if n > 0:
        for i in range(1, 61):
            split = 2 ** i
            flag1 = (n // split) * (split // 2)
            flag2 = max(n % split + 1 - (split // 2), 0)
            flaglist[i] += flag1 + flag2
# 1 ~ A - 1について（Aは範囲に入っているため） n > 0 n 0 for i in range(1, 61):
            split = 2 ** i
            flag1 = (n // split) * (split // 2)
            flag2 = max(n % split + 1 - (split // 2), 0)
            flaglist[i] += flag1 + flag2
# 1 ~ A - 1について（Aは範囲に入っているため） i range(1, 61) range 1 61 split = 2 ** i split 2 ** i 2 i flag1 = (n // split) * (split // 2) flag1 (n // split) * (split // 2) n // split n split split // 2 split 2 flag2 = max(n % split + 1 - (split // 2), 0) flag2 max(n % split + 1 - (split // 2), 0) max n % split + 1 - (split // 2) n % split + 1 n % split n split 1 split // 2 split 2 0 flaglist[i] += flag1 + flag2 flaglist[i] flaglist i flag1 + flag2 flag1 flag2 n n flaglist flaglist bitflag(A - 1, flags1) bitflag A - 1 A 1 flags1 bitflag(B, flags2) bitflag B flags2 for i in range(61):
    flags2[i] -= flags1[i] i range(61) range 61 flags2[i] -= flags1[i] flags2[i] flags2 i flags1[i] flags1 i ans = 0 ans 0 for i in range(61):
    if flags2[i] % 2 != 0:
        ans += 2 ** (i - 1) i range(61) range 61 if flags2[i] % 2 != 0:
        ans += 2 ** (i - 1) flags2[i] % 2 != 0 flags2[i] % 2 flags2[i] flags2 i 2 0 ans += 2 ** (i - 1) ans 2 ** (i - 1) 2 i - 1 i 1 print(ans) print ans flags1 = [0] * 61 [0] * 61 flags1 flags2 = [0] * 61 [0] * 61 flags2 ans = 0 0 ans def getList():
    return list(map(int, input().split())) def getList():
    return list(map(int, input().split())) getList def getArray(intn):
    return [int(input()) for i in range(intn)] def getArray(intn):
    return [int(input()) for i in range(intn)] getArray def getNM():
    return map(int, input().split()) def getNM():
    return map(int, input().split()) getNM def input():
    return sys.stdin.readline().rstrip() def input():
    return sys.stdin.readline().rstrip() input mod = 10 ** 9 + 7 10 ** 9 + 7 mod A, B = getNM() getNM() A def getN():
    return int(input()) def getN():
    return int(input()) getN B = getNM() getNM() B def bitflag(n, flaglist):
    if n > 0:
        for i in range(1, 61):
            split = 2 ** i
            flag1 = (n // split) * (split // 2)
            flag2 = max(n % split + 1 - (split // 2), 0)
            flaglist[i] += flag1 + flag2
# 1 ~ A - 1について（Aは範囲に入っているため） def bitflag(n, flaglist):
    if n > 0:
        for i in range(1, 61):
            split = 2 ** i
            flag1 = (n // split) * (split // 2)
            flag2 = max(n % split + 1 - (split // 2), 0)
            flaglist[i] += flag1 + flag2
# 1 ~ A - 1について（Aは範囲に入っているため） bitflag ans += 2 ** (i - 1) 2 ** (i - 1) ans
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

A, B = getNM()
# bit1桁目のフラグの個数
# 周期は2 ** 1
# 0と1が交互に
# bit2桁目のフラグの個数
# 周期は2 ** 2
flags1 = [0] * 61
flags2 = [0] * 61
# 1 ~ nまでに各桁のフラグが何本立つか計算する関数
def bitflag(n, flaglist):
    if n > 0:
        for i in range(1, 61):
            split = 2 ** i
            flag1 = (n // split) * (split // 2)
            flag2 = max(n % split + 1 - (split // 2), 0)
            flaglist[i] += flag1 + flag2
# 1 ~ A - 1について（Aは範囲に入っているため）
bitflag(A - 1, flags1)
bitflag(B, flags2)
for i in range(61):
    flags2[i] -= flags1[i]
ans = 0
# 奇数ならフラグが立つ
for i in range(61):
    if flags2[i] % 2 != 0:
        ans += 2 ** (i - 1)
print(ans)