#include <bits/stdc++.h>
using namespace std;
long long l, r, tmpXor;
long long ans;
int main() {
  cin >> l >> r;
  tmpXor = l ^ r;
  int cntDigits = 0;
  while (tmpXor > 0) {
    tmpXor /= 2;
    cntDigits += 1;
  }
  for (int i = 1; i <= cntDigits; ++i) ans = ans * 2 + 1;
  cout << ans << endl;
  return 0;
}
