#include using namespace std; typedef long long int ll; typedef pair pll; #define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i)) #define REP(i, n) FOR(i,n,0) #define OF64 std::setprecision(10) const ll MOD = 1000000007; const ll INF = (ll) 1e15; int main() { ll A, B; cin >> A >> B; ll n = 0; REP(i, 40) { ll a = (A >> i) & 1; ll b = (B >> i) & 1; if (a == 1 && b == 0) { cout << 0 << endl; return 0; } if (a != b) n++; } cout << pow(2, n - 1) << endl; return 0; }