a,b=map(int,input().split()) print(len([i for i in range(256) if (i|a) == b]))