function main(input) {
  const formatted_input = input.split('\n');
  const A =  parseInt(formatted_input[0].split(' ')[0]);
  const B =  parseInt(formatted_input[0].split(' ')[1]);

  var result = A;
  for(var i=0;i < B-A ; i++){
    result = result ^ (A+i+1)
  }

  console.log(result);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

