#include <bits/stdc++.h>
const int inf = int(1e9);
const int mod = inf + 7;
using namespace std;
void solve() {
  long long l, r;
  cin >> l >> r;
  long long c1 = 0, c2 = 0;
  for (long long i = 61; i >= 0; --i) {
    if (c1 + (1ll << i) <= r) {
      c1 += (1ll << i);
      if (c2 + (1ll << i) - 1 < l) {
        c2 += (1ll << i);
      }
    } else if (c2 + (1ll << i) <= r) {
      c2 += (1ll << i);
      if (c1 + (1ll << i) - 1 < l) {
        c1 += 1 << (i);
      }
    }
    if (c1 > c2) swap(c1, c2);
  }
  cout << (c1 xor c2);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
