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

def f(X):
  a = 1
  temp = 2
  ret = []
  while a > 0:
    a, b = divmod(X+1, temp)
    if temp == 2:
      ret.append(a%2)
    else:
      ret.append(max(b-(temp//2), 0)%2)
    temp *= 2
  return "".join(map(str, reversed(ret)))

print(int(f(max(0, A-1)), 2)^int(f(B), 2)) A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B def f(X):
  a = 1
  temp = 2
  ret = []
  while a > 0:
    a, b = divmod(X+1, temp)
    if temp == 2:
      ret.append(a%2)
    else:
      ret.append(max(b-(temp//2), 0)%2)
    temp *= 2
  return "".join(map(str, reversed(ret))) f a = 1 a 1 temp = 2 temp 2 ret = [] ret [] while a > 0:
    a, b = divmod(X+1, temp)
    if temp == 2:
      ret.append(a%2)
    else:
      ret.append(max(b-(temp//2), 0)%2)
    temp *= 2
   a > 0 a 0 a, b = divmod(X+1, temp) a divmod(X+1, temp) divmod X+1 X 1 temp b if temp == 2:
      ret.append(a%2)
    else:
      ret.append(max(b-(temp//2), 0)%2)
     temp == 2 temp 2 ret.append(a%2) ret.append ret append a%2 a 2 ret.append(max(b-(temp//2), 0)%2) ret.append ret append max(b-(temp//2), 0)%2 max(b-(temp//2), 0) max b-(temp//2) b temp//2 temp 2 0 2 temp *= 2 temp 2 return "".join(map(str, reversed(ret))) "".join(map(str, reversed(ret))) "".join "" join map(str, reversed(ret)) map str reversed(ret) reversed ret X X print(int(f(max(0, A-1)), 2)^int(f(B), 2)) print int(f(max(0, A-1)), 2)^int(f(B), 2) int(f(max(0, A-1)), 2) int f(max(0, A-1)) f max(0, A-1) max 0 A-1 A 1 2 int(f(B), 2) int f(B) f B 2 B = map(int, input().split()) map(int, input().split()) B A, B = map(int, input().split()) map(int, input().split()) A def f(X):
  a = 1
  temp = 2
  ret = []
  while a > 0:
    a, b = divmod(X+1, temp)
    if temp == 2:
      ret.append(a%2)
    else:
      ret.append(max(b-(temp//2), 0)%2)
    temp *= 2
  return "".join(map(str, reversed(ret))) def f(X):
  a = 1
  temp = 2
  ret = []
  while a > 0:
    a, b = divmod(X+1, temp)
    if temp == 2:
      ret.append(a%2)
    else:
      ret.append(max(b-(temp//2), 0)%2)
    temp *= 2
  return "".join(map(str, reversed(ret))) f
A, B = map(int, input().split())

def f(X):
  a = 1
  temp = 2
  ret = []
  while a > 0:
    a, b = divmod(X+1, temp)
    if temp == 2:
      ret.append(a%2)
    else:
      ret.append(max(b-(temp//2), 0)%2)
    temp *= 2
  return "".join(map(str, reversed(ret)))

print(int(f(max(0, A-1)), 2)^int(f(B), 2))