#include using namespace std; int main() { long a, b, x, d = 0; cin >> a >> b; x = a ^ b; if (a & b != a) { cout << 0 << endl; return 0; } while (x) { d += x % 2; x /= 2; } cout << ((1l << d) + 1) / 2 << endl; }