#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const int MOD = 1e9 + 7;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long l, r;
  long long ans = -1;
  cin >> l >> r;
  for (int i = 0; l > 0 || r > 0; ++i) {
    if ((l & 1) != (r & 1)) ans = i;
    l >>= 1;
    r >>= 1;
  }
  cout << (1LL << (ans + 1)) - 1 << "\n";
  return 0;
}
