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