#include void solve() { int x, y; std::cin >> x >> y; if ((x & y) != x) { std::cout << 0 << std::endl; return; } int c = __builtin_popcount(x ^ y); std::cout << (c == 0 ? 1 : 1 << (c - 1)) << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }