#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long long MOD = 1e9 + 7;
const long long INF = 0x3F3F3F3F3F3F3F3F;
long double EPS = 1e-12;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ifstream fin("ip.txt");
  ofstream fout("op.txt");
  {
    long long l, r;
    cin >> l >> r;
    bitset<63> d(l), u(r), a(0);
    string U = u.to_string();
    string D = d.to_string();
    string A = a.to_string();
    bool shuru = false;
    for (long long i = (0); i <= (63); i++) {
      if (!shuru && U[i] == D[i]) {
        A[i] = '0';
        continue;
      }
      shuru = true, A[i] = '1';
    }
    bitset<63> ans(A);
    cout << ans.to_ullong() << endl;
  }
}
