#include using namespace std; typedef long long ll; int main() { ll A, B; cin >> A >> B; ll t = 1; ll ans = 0; 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 != 0) { //cout << u << " " << v << "\n"; ans++; } t *= 2; } ans = max(ans, 1ll); cout << (1<<(ans - 1)) << "\n"; return 0; }