#include <bits/stdc++.h>
using namespace std;
int main() {
  long long l, r;
  cin >> l >> r;
  long long num = (l ^ r);
  int pos = 0;
  while (num > 0) {
    pos++;
    num = num >> 1;
  }
  long long ans = pow(2, pos);
  cout << ans - 1 << '\n';
}
