'use strict'

function myXor(a,b){
	let sa = a.toString(2);
	let sb = b.toString(2);
	if(sa.length < sb.length){
		sa = ('0000000000000000000000000000000000000000000000000000000000000000'+sa).slice(-sb.length);
	}else if(sa.length > sb.length){
		sb = ('0000000000000000000000000000000000000000000000000000000000000000'+sb).slice(-sa.length);
	}
	let answer = new Number(0);
	let bi = new Number(1);
	for(let i=sa.length-1;i>=0;i--){
		if((sa[i]==="0"&&sb[i]==="1")||(sa[i]==="1"&&sb[i]==="0")){
			answer += bi;
		}
		bi *= 2;
	}
	return answer;
}

function myShift(b,n){
	for(let i=0;i<n;i++){
		b *= 2;
	}
	return b;
}

function count1(X,i){
	let n = X % myShift(1,i);
	//console.log("n:",X,myShift(1,i));
	if(n < myShift(1,(i-1))) return 0;
	
	//console.log("return:",(X+1)%2)
	return (X+1)%2;
}

function getXorNumber(X){
	//console.log("------",X);
	let answer = new Number(0);

	//2進1桁目だけ別計算
	answer += Math.floor((X+1)/2)%2;

	//console.log("bit:",1,answer,answer);

	//2進2桁目以降
	let bit = new Number(0);
	for(let i=2;i<52;i++){
		bit = 1;
		for(let j=1;j<i;j++) bit *= 2;
		if(bit > X) break;

		if(count1(X,i) === 1) answer += bit;	

		//console.log("bit:",i,bit,answer);
	}
	return answer;
}

function Main(input){
	let temp = input.trim().split(" ");
	let A = parseInt(temp[0]);
	let B = parseInt(temp[1]);

	if(A===B || A===0){
		console.log(B);
		return;
	}
	let u = new Number(0);
	u = getXorNumber(B);
	let l = new Number(0);
	l = getXorNumber(A-1);
	//console.log(u.toString(2));
	//console.log(l.toString(2));
	console.log(myXor(u,l));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));