def split(word): 
    return [char for char in word]
def convert(s): 
  
    # initialization of string to "" 
    new = "" 
  
    # traverse in the string  
    for x in s: 
        new += x  
  
    # return string  
    return new 
a,b=map(int,input().split())
ans=[]
abin="{0:b}".format(a)
bbin="{0:b}".format(b)
abin=split(abin)
bbin=split(bbin)
abin.reverse()
bbin.reverse()
for i in range(len(bbin)-len(abin)):
  abin.append('0')
if (abin[0]=='1' and ((b-a)%4==0 or (b-a)%4==1)) or (abin[0]=='0' and ((b-a)%4==1 or (b-a)%4==2)) :
  ans.append('1')
else:
  ans.append('0')
for i in range(1,len(bbin)):
  flag=0
  if abin[i]=='1' and a%2==1:
    flag+=1
  if bbin[i]=='1' and b%2==0:
    flag+=1
  if flag==1:
    ans.append('1')
  else:
    ans.append('0')
ans.reverse()
print(int(convert(ans),2)) def split(word): 
    return [char for char in word] split char for char in word for char in word char word for char in word char return [char for char in word] [char for char in word] word word def convert(s): 
  
    # initialization of string to "" 
    new = "" 
  
    # traverse in the string  
    for x in s: 
        new += x  
  
    # return string  
    return new  convert new = "" new "" for x in s: 
        new += x  
  
    # return string  
     x s new += x new x return new new s s a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b ans=[] ans [] abin="{0:b}".format(a) abin "{0:b}".format(a) "{0:b}".format "{0:b}" format a bbin="{0:b}".format(b) bbin "{0:b}".format(b) "{0:b}".format "{0:b}" format b abin=split(abin) abin split(abin) split abin bbin=split(bbin) bbin split(bbin) split bbin abin.reverse() abin.reverse abin reverse bbin.reverse() bbin.reverse bbin reverse for i in range(len(bbin)-len(abin)):
  abin.append('0') i range(len(bbin)-len(abin)) range len(bbin)-len(abin) len(bbin) len bbin len(abin) len abin abin.append('0') abin.append abin append '0' if (abin[0]=='1' and ((b-a)%4==0 or (b-a)%4==1)) or (abin[0]=='0' and ((b-a)%4==1 or (b-a)%4==2)) :
  ans.append('1')
else:
  ans.append('0') (abin[0]=='1' and ((b-a)%4==0 or (b-a)%4==1)) or (abin[0]=='0' and ((b-a)%4==1 or (b-a)%4==2)) abin[0]=='1' and ((b-a)%4==0 or (b-a)%4==1) abin[0]=='1' abin[0] abin 0 '1' (b-a)%4==0 or (b-a)%4==1 (b-a)%4==0 (b-a)%4 b-a b a 4 0 (b-a)%4==1 (b-a)%4 b-a b a 4 1 abin[0]=='0' and ((b-a)%4==1 or (b-a)%4==2) abin[0]=='0' abin[0] abin 0 '0' (b-a)%4==1 or (b-a)%4==2 (b-a)%4==1 (b-a)%4 b-a b a 4 1 (b-a)%4==2 (b-a)%4 b-a b a 4 2 ans.append('1') ans.append ans append '1' ans.append('0') ans.append ans append '0' for i in range(1,len(bbin)):
  flag=0
  if abin[i]=='1' and a%2==1:
    flag+=1
  if bbin[i]=='1' and b%2==0:
    flag+=1
  if flag==1:
    ans.append('1')
  else:
    ans.append('0') i range(1,len(bbin)) range 1 len(bbin) len bbin flag=0 flag 0 if abin[i]=='1' and a%2==1:
    flag+=1
   abin[i]=='1' and a%2==1 abin[i]=='1' abin[i] abin i '1' a%2==1 a%2 a 2 1 flag+=1 flag 1 if bbin[i]=='1' and b%2==0:
    flag+=1
   bbin[i]=='1' and b%2==0 bbin[i]=='1' bbin[i] bbin i '1' b%2==0 b%2 b 2 0 flag+=1 flag 1 if flag==1:
    ans.append('1')
  else:
    ans.append('0') flag==1 flag 1 ans.append('1') ans.append ans append '1' ans.append('0') ans.append ans append '0' ans.reverse() ans.reverse ans reverse print(int(convert(ans),2)) print int(convert(ans),2) int convert(ans) convert ans 2 abin=split(abin) split(abin) abin flag=0 0 flag flag+=1 1 flag flag+=1 1 flag def split(word): 
    return [char for char in word] def split(word): 
    return [char for char in word] split b=map(int,input().split()) map(int,input().split()) b ans=[] [] ans a,b=map(int,input().split()) map(int,input().split()) a def convert(s): 
  
    # initialization of string to "" 
    new = "" 
  
    # traverse in the string  
    for x in s: 
        new += x  
  
    # return string  
    return new  def convert(s): 
  
    # initialization of string to "" 
    new = "" 
  
    # traverse in the string  
    for x in s: 
        new += x  
  
    # return string  
    return new  convert bbin=split(bbin) split(bbin) bbin bbin="{0:b}".format(b) "{0:b}".format(b) bbin abin="{0:b}".format(a) "{0:b}".format(a) abin
def split(word): 
    return [char for char in word]
def convert(s): 
  
    # initialization of string to "" 
    new = "" 
  
    # traverse in the string  
    for x in s: 
        new += x  
  
    # return string  
    return new 
a,b=map(int,input().split())
ans=[]
abin="{0:b}".format(a)
bbin="{0:b}".format(b)
abin=split(abin)
bbin=split(bbin)
abin.reverse()
bbin.reverse()
for i in range(len(bbin)-len(abin)):
  abin.append('0')
if (abin[0]=='1' and ((b-a)%4==0 or (b-a)%4==1)) or (abin[0]=='0' and ((b-a)%4==1 or (b-a)%4==2)) :
  ans.append('1')
else:
  ans.append('0')
for i in range(1,len(bbin)):
  flag=0
  if abin[i]=='1' and a%2==1:
    flag+=1
  if bbin[i]=='1' and b%2==0:
    flag+=1
  if flag==1:
    ans.append('1')
  else:
    ans.append('0')
ans.reverse()
print(int(convert(ans),2))