#include using namespace std; typedef long long ll; int main() { ll A, B; cin >> A >> B; ll t = 1; ll ans = 1; for (int i = 0; i < 31; i++) { ll u = A & t; ll v = B & t; if (u != 0 && v == 0) { cout << 0 << "\n"; return 0; } else if (u == 0 && v == 1) { ans *= 2; } t *= 2; } cout << ans << "\n"; return 0; }