from sys import stdin def main(): input = lambda: stdin.readline()[:-1] A, B = map(int, input().split()) if A & B != A: print(0) return i, n = 0, 0 max_ = max(A, B) while max_ > 0: ai = A & 1 << i bi = B & 1 << i if (not ai and bi) or (ai and not bi): n += 1 max_ //= 2 i += 1 print(2 ** (n - 1)) main()