#include using namespace std; typedef long long ll; typedef pair P; #define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0) #define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0) int main() { int a,b; cin >> a >> b; int cnt = 0; bool ok = true; for (int i = 0;i < 31;++i) { if (((a>>i)&1) == 0 && ((b>>i)&1)) cnt++; if (((a>>i)&1) && ((b>>i)&1) == 0) ok = false; } if (ok) { if (cnt) cnt--; cout << (1<