#include <bits/stdc++.h>
using namespace std;
vector<int> a, b;
int main() {
  long long l, r, t;
  cin >> l >> r;
  if (l == r) {
    cout << "0";
    return 0;
  }
  while (l) {
    t = l % 2;
    a.push_back(t);
    l /= 2;
  }
  while (r) {
    t = r % 2;
    b.push_back(t);
    r /= 2;
  }
  int c = b.size() - a.size();
  for (int i = 0; i < c; i++) a.push_back(0);
  long long p = a.size();
  for (long long i = p - 1; i >= 0; i--) {
    if (a[i] != b[i]) {
      long long pp = pow(2, i + 1) - 1;
      cout << pp << endl;
      return 0;
    }
  }
  return 0;
}
