#include using namespace std; bool isPowerofTwo(int n) { // Check if n is positive and n & ~(n-1) equals n return (n > 0) && ((n & (~(n-1))) == n); } int main() { long long int a,c; cin >> a >>c; if(a>c) swap(a,c); long long int val = log2(c); long long int ans = 1; if(isPowerofTwo(a) && isPowerofTwo(c)) ans++; ans = ans << val; cout << ans-1; // your code goes here }