#include using namespace std::literals::string_literals; using i64 = std::int_fast64_t; using std::cout; using std::cerr; using std::endl; using std::cin; template std::vector make_v(size_t a){return std::vector(a);} template auto make_v(size_t a,Ts... ts){ return std::vector(ts...))>(a,make_v(ts...)); } int main() { int a, b; scanf("%d%d", &a, &b); i64 ans = 1; for(int i = 0; i < 32; i++) { if(a >> i & 1) ans *= 1; else ans *= (1 + (b >> i & 1)); if((a >> i & 1) and !(b >> i & 1)) ans = 0; } printf("%lld\n", ans >> 1); return 0; }