#include <bits/stdc++.h>
using namespace std;
#define int long long
int MAXN = (1ll << 60);
int getAns(int l, int r, int plc = 60, int s = 0, int e = MAXN) {
	if (plc < 0)
		return 0;
	if (r <= s || e <= l)
		return 0;
	if (l <= s && e <= r)
		return e - s;
	int mid = (s + e) / 2, fr = getAns(l, r, plc - 1, s, mid), sd = getAns(l, r, plc - 1, mid, e);
	if (sd == 0)
		return fr;
	else 
		return (fr + min(fr + sd, e - mid));
}
int32_t main() {
	int a, b;
	cin >> a >> b;
	cout << getAns(a, b + 1);
}