#include using namespace std; using ll = long long; int main() { ll a, b; cin >> a >> b; int cnt01 = 0; for (int i = 0; i < 31; i++) { if ((a & (1ll << i)) && !(b & (1ll << i))) { cout << 0 << endl; return 0; } else if (!(a & (1ll << i)) && (b & (1ll << i))) cnt01++; } cout << 1ll << (cnt01 - 1) << endl; }