a,b = map(int,input().split()) cnt = 0 while a > 0 or b > 0: c,d = a&1, b&1 if c != d: if d: cnt += 1 else: print(0) exit() a //= 2 b //= 2 if cnt == 0: print(1) else: print(2 ** (cnt - 1))