a,b=map(int,input().split()) cnt=0 for i in range(0,256): if a | i == b: cnt+=1 print(cnt)