#include using std::cin; using std::cout; using std::endl; std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count()); template inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } const int inf = (int)1e9 + 7; const long long INF = 1LL << 60; void solve() { int A, B; cin >> A >> B; if (A == 0 or B == 0) { cout << 0 << "\n"; return; } int msb_a = -1, msb_b = -1; { for (int i = 0; i < 30; i++) { if (A >> i & 1) { msb_a = i; } } { for (int i = 0; i < 30; i++) { if (B >> i & 1) { msb_b = i; } } } } if (msb_a == msb_b) { cout << (1 << msb_a) - 1 << "\n"; } else { cout << (1 << (std::min(msb_a, msb_b) + 1)) - 1 << "\n"; } } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); int I_love_KKT89 = 1; // cin >> I_love_KKT89; for (int Case = 1; Case <= I_love_KKT89; ++Case) { // cout << "Case #" << Case << ": "; solve(); } return 0; }