local a, b = io.read("*n", "*n")
local s, t = {}, {}
for i = 1, 33 do
  s[i] = a % 2 == 1
  t[i] = b % 2 == 1
  a = math.floor(a / 2)
  b = math.floor(b / 2)
end
local ret = 1
for i = 1, 33 do
  if s[i] then
    if not t[i] then
      ret = 0
      break
    end
  else
    if t[i] then
      ret = ret * 2
    end
  end
end
print(1 < ret and ret / 2 or ret)