a, b = map(int, input().split()) A = [0 for _ in range(30)] B = [0 for _ in range(30)] for i in range(30): a, r = divmod(a, 2) A[i] = r b, r = divmod(b, 2) B[i] = r flag = True d = 0 for i in range(30): if A[i] == 1: if A[i] != B[i]: flag = False break else: if B[i] == 1: d += 1 if flag: if d == 0: print(1) else: print(pow(2, d - 1)) else: print(0)