A, B = map(int, input().split())

if A == 0:
  print(B)
  exit()
  
a = A - 1
rlt = ((B+1)//2 - (a+1)//2) % 2

for i in range(1, 40):
  pw1 = 2**i
  pw2 = pw1*2
  cnta = max(a % pw2 - pw1 + 1, 0)
  cntB = max(B % pw2 - pw1 + 1, 0)
  rlt += ((cntB - cnta) % 2)*pw1
  
print(rlt) A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B if A == 0:
  print(B)
  exit()
   A == 0 A 0 print(B) print B exit() exit a = A - 1 a A - 1 A 1 rlt = ((B+1)//2 - (a+1)//2) % 2 rlt ((B+1)//2 - (a+1)//2) % 2 (B+1)//2 - (a+1)//2 (B+1)//2 B+1 B 1 2 (a+1)//2 a+1 a 1 2 2 for i in range(1, 40):
  pw1 = 2**i
  pw2 = pw1*2
  cnta = max(a % pw2 - pw1 + 1, 0)
  cntB = max(B % pw2 - pw1 + 1, 0)
  rlt += ((cntB - cnta) % 2)*pw1
   i range(1, 40) range 1 40 pw1 = 2**i pw1 2**i 2 i pw2 = pw1*2 pw2 pw1*2 pw1 2 cnta = max(a % pw2 - pw1 + 1, 0) cnta max(a % pw2 - pw1 + 1, 0) max a % pw2 - pw1 + 1 a % pw2 - pw1 a % pw2 a pw2 pw1 1 0 cntB = max(B % pw2 - pw1 + 1, 0) cntB max(B % pw2 - pw1 + 1, 0) max B % pw2 - pw1 + 1 B % pw2 - pw1 B % pw2 B pw2 pw1 1 0 rlt += ((cntB - cnta) % 2)*pw1 rlt ((cntB - cnta) % 2)*pw1 (cntB - cnta) % 2 cntB - cnta cntB cnta 2 pw1 print(rlt) print rlt a = A - 1 A - 1 a cnta = max(a % pw2 - pw1 + 1, 0) max(a % pw2 - pw1 + 1, 0) cnta rlt += ((cntB - cnta) % 2)*pw1 ((cntB - cnta) % 2)*pw1 rlt pw2 = pw1*2 pw1*2 pw2 A, B = map(int, input().split()) map(int, input().split()) A B = map(int, input().split()) map(int, input().split()) B pw1 = 2**i 2**i pw1 rlt = ((B+1)//2 - (a+1)//2) % 2 ((B+1)//2 - (a+1)//2) % 2 rlt cntB = max(B % pw2 - pw1 + 1, 0) max(B % pw2 - pw1 + 1, 0) cntB
A, B = map(int, input().split())

if A == 0:
  print(B)
  exit()
  
a = A - 1
rlt = ((B+1)//2 - (a+1)//2) % 2

for i in range(1, 40):
  pw1 = 2**i
  pw2 = pw1*2
  cnta = max(a % pw2 - pw1 + 1, 0)
  cntB = max(B % pw2 - pw1 + 1, 0)
  rlt += ((cntB - cnta) % 2)*pw1
  
print(rlt)