def main(): A, B = map(int, input().split()) if A > B: print(0) cnt = 1 for i in range(40): if A & (1 << i): if B & (1 << i): cnt *= 1 else: cnt *= 0 else: if B & (1 << i): cnt *= 2 else: cnt *= 1 if cnt == 1: print(cnt) exit() else: print(cnt // 2) if __name__ == "__main__": main()