#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;

int main()
{
    int a, b;
	cin>>a>>b;
	ll ans=1;
	for(int i=0; i<31; i++){
		int x=((a>>i)&1), y=((b>>i)&1);
		if(x==0 && y==1) ans*=2;
		else if(x==1 && y==0){
			cout<<0<<endl;
			return 0;
		}
	}
	if(a==b){
		cout<<1<<endl;
	}else{
		ans/=2;
		cout<<ans<<endl;
	}
    return 0;
}