#include <bits/stdc++.h>
using namespace std;
const int N = 1.5e6;
long long l, r, RES = -1, ff;
void solve(long long value, long long currBit, long long currValue) {
  if (currBit == -1) {
    if (currValue >= l && currValue <= r) RES = max(RES, (currValue ^ value));
    return;
  }
  if (value & (1LL << currBit)) {
    if (currBit == 0) {
      if (currValue >= l)
        solve(value, currBit - 1, currValue);
      else
        solve(value, currBit - 1, currValue + 1);
    } else {
      if (currValue + (1LL << (currBit - 1)) < l)
        solve(value, currBit - 1, currValue + (1LL << currBit));
      else
        solve(value, currBit - 1, currValue);
    }
  } else {
    if (currValue + (1LL << currBit) > r)
      solve(value, currBit - 1, currValue);
    else
      solve(value, currBit - 1, currValue + (1LL << currBit));
  }
}
mt19937_64 mt_rnd_64(chrono::steady_clock::now().time_since_epoch().count());
long long rnd(long long l, long long r) {
  return (mt_rnd_64() % (r - l + 1)) + l;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> l >> r;
  for (int i = 0; i < N; i++) {
    ff = rnd(l, r);
    solve(ff, 60, 0);
  }
  cout << RES;
}
