a, b = map(int, input().split()) if a | b != b: print(0) exit() elif a == b: print(1) exit() x = a ^ b cnt = bin(x).count("1") print(pow(2, cnt - 1))