A, B = map(int,input().split()) ans = 1 if A==B: print(1) exit() while A or B: a = A&1 b = B&1 if a == 1 and b == 0: ans *= 0 if a == 0 and b == 1: ans *= 2 A >>= 1 B >>= 1 print(ans//2)