a,b=map(int,input().split())
def f(x):
  r=x%2^x//2%2
  p=2
  for i in range(len(bin(x))-3):
    r+=p-p*(x%2 or x%(p*2)<p)
    p*=2
  return r
print(f(a-1)^f(b)) a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b def f(x):
  r=x%2^x//2%2
  p=2
  for i in range(len(bin(x))-3):
    r+=p-p*(x%2 or x%(p*2)<p)
    p*=2
  return r f r=x%2^x//2%2 r x%2^x//2%2 x%2 x 2 x//2%2 x//2 x 2 2 p=2 p 2 for i in range(len(bin(x))-3):
    r+=p-p*(x%2 or x%(p*2)<p)
    p*=2
   i range(len(bin(x))-3) range len(bin(x))-3 len(bin(x)) len bin(x) bin x 3 r+=p-p*(x%2 or x%(p*2)<p) r p-p*(x%2 or x%(p*2)<p) p p*(x%2 or x%(p*2)<p) p x%2 or x%(p*2)<p x%2 x 2 x%(p*2)<p x%(p*2) x p*2 p 2 p p*=2 p 2 return r r x x print(f(a-1)^f(b)) print f(a-1)^f(b) f(a-1) f a-1 a 1 f(b) f b def f(x):
  r=x%2^x//2%2
  p=2
  for i in range(len(bin(x))-3):
    r+=p-p*(x%2 or x%(p*2)<p)
    p*=2
  return r def f(x):
  r=x%2^x//2%2
  p=2
  for i in range(len(bin(x))-3):
    r+=p-p*(x%2 or x%(p*2)<p)
    p*=2
  return r f a,b=map(int,input().split()) map(int,input().split()) a b=map(int,input().split()) map(int,input().split()) b
a,b=map(int,input().split())
def f(x):
  r=x%2^x//2%2
  p=2
  for i in range(len(bin(x))-3):
    r+=p-p*(x%2 or x%(p*2)<p)
    p*=2
  return r
print(f(a-1)^f(b))