A,B=map(int,input().split()) if A==B: print(1) exit() K=32 W=1 T=[[1,2],[0,1]] for _ in range(K): W*=T[A&1][B&1] A>>=1 B>>=1 print(W//2)