a_raw, b_raw = map(int, input().split()) a = bin(a_raw)[2:] b = bin(b_raw)[2:] L = max(len(a), len(b)) a.zfill(L) b.zfill(L) ans = 1 for i in range(L): if a[i] == '0' and b[i] == '1': ans *= 2 elif a[i] == '1' and b[i] == '0': print(0) exit() if ans == 1: print(1) else: print(ans // 2)