#include <bits/stdc++.h>
const int maxi = 2000000000;
const int maxq = 1000000000;
const double eps = 1e-10;
const double pi = 3.1415926535897932;
const double inf = 1e+18;
const int mo = 1000000007;
using namespace std;
long long l, r;
int main() {
  cin >> l >> r;
  if (l == r) {
    puts("0");
    return 0;
  }
  for (int i = 62; i >= 0; i--) {
    if ((1ll << (i)) > l && (1ll << (i)) <= r) {
      cout << (1ll << (i + 1)) - 1 << endl;
      return 0;
    }
    if ((1ll << (i)) <= l) {
      l -= (1ll << (i));
      r -= (1ll << (i));
    }
  }
  return 0;
}
