#include <bits/stdc++.h>
using namespace std;
const int N = 5e3 + 5, M = 7e4 + 7, mod = 1e8;
const double ESP = 1e-8;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long l, r;
  cin >> l >> r;
  long long ans = 0;
  for (long long i = 60LL; ~i; i--) {
    if (ans + (1LL << i) <= r) {
      ans += (1LL << i);
    }
    if (ans > l && ans <= r) {
      return cout << (ans ^ (ans - 1)), 0;
    }
  }
  return cout << 0, 0;
}
