#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 & (1 << i)) && !(b & (1 << i))) { cout << 0 << endl; return 0; } else if (!(a & (1 << i)) && (b & (1 << i))) cnt01++; } cout << (1 << (cnt01 - 1)) << endl; }