#include<bits/stdc++.h>
using namespace std;

main(){cin.tie(0);ios::sync_with_stdio(false);
	int A,B,x=1;
	bool f=false;
	cin>>A>>B;
	for(;A||B;A/=2,B/=2){
		if(A%2==0&&B%2==1){
			if(f){
				x*=2;
			}else{
				f=true;
			}
		}else if(A%2==1&&B%2==0){
			x=0;
		}
	}
	cout<<x<<endl;
}