local a, b = io.read("*n", "*n")

local function getallxor(x)
  if(x <= 0) then return 0 end
  local tmnt = false
  local ret = {}
  local div = 2
  while(not tmnt) do
    local quot = math.floor(x / div)
    if(quot == 0) then tmnt = true end
    local c = quot * div / 2
    local rem = x % div
    c = c + math.max(0, rem - div / 2 + 1)
    table.insert(ret, c % 2)
    div = div * 2
  end
  return ret
end

local left, right = getallxor(a - 1), getallxor(b)
local mul, step = 1, 1
local final = 0
while(step <= #right) do
  if(step <= #left) then
    final = final + mul * ((left[step] + right[step]) % 2)
  else
    final = final + mul * right[step]
  end
  mul, step = mul * 2, step + 1
end
print(final)
