A, B = map(int, input().split()) ans = 0 for i in range(256): if A | i == B: ans += 1 print(ans)