#!/usr/bin/env python3 def solve(a, b): if a | b != b: return 0 k = str(bin(a ^ b)).count('1') if k == 0: return 1 else: return pow(2, k - 1) print(solve(*map(int, input().split())))