'use strict'

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

	let xor = A;
	for(let i=A+1;i<=B;i++){
		xor ^= i;
	}
	console.log(xor);
}

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