#include <bits/stdc++.h>
using namespace std;
int matrix[51][51];
int main() {
  long long int L, R;
  cin >> L >> R;
  if (L == R) {
    cout << 0 << endl;
    return 0;
  }
  cout << (1LL << ((long long int)log2(L ^ R) + 1)) - 1 << endl;
  return 0;
}
