#include <bits/stdc++.h>
using namespace std;
long long an, b = 1, c, l, r, ll, rr;
int i, j, n, m;
int main() {
  cin >> l >> r;
  rr = r;
  while (rr > 0) {
    rr /= 2;
    n++;
  }
  an = l ^ r;
  rr = r;
  ll = l;
  for (i = n - 1; i >= 1; i--) b = b * 2;
  for (i = n - 1; i >= 0; i--) {
    if (!(an & (b))) {
      if (rr & b) {
        if (rr - b >= l) rr = rr - b;
      } else {
        if (ll + b <= r) ll = ll + b;
      }
    }
    b = b / 2;
  }
  c = ll ^ rr;
  cout << c;
  return 0;
}
