#include <vector>
#include <iostream>
using namespace std;
int main() {
	long long X, Y;
	cin >> X >> Y;
	long long ans = 1;
	for (int i = 0; i < 32; ++i) {
		int b1 = ((X >> i) & 1), b2 = ((Y >> i) & 1);
		if (b1 == 1 && b2 == 0) ans = 0;
		if (b1 == 0 && b2 == 1) ans *= 2;
	}
	cout << (ans + 1) / 2 << endl;
	return 0;
}