#include <bits/stdc++.h>
using namespace std;
long long l, r;
void readInput() { cin >> l >> r; }
void solve() {
  if (l == r)
    cout << 0 << endl;
  else
    cout << (1ll << (63 - __builtin_clzll(l ^ r)) + 1) - 1 << endl;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  readInput(), solve();
  return 0;
}
