#include <bits/stdc++.h>
using namespace std;
long long M = 1e8;
int main() {
  long long l, r, L, R;
  cin >> l >> r;
  if (l == r) {
    cout << 0 << endl;
    return 0;
  }
label:
  L = floor(log2(l));
  R = floor(log2(r));
  if (L == R) {
    l -= pow(2, L);
    r -= pow(2, L);
    goto label;
  }
  cout << (long long)pow(2, R + 1) - 1 << endl;
  return 0;
}
