var lines = [];


var readline = require("readline");
var rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

rl.on('line', function (x) {
  lines.push(x);
});

rl.on('close', function () {
  var A = Number(lines[0].split(" ")[0]);
  var B = Number(lines[0].split(" ")[1]);

  var a = xor_sum(B)
  var b = xor_sum(A - 1)
  var c = ((a ^ b) >>> 0);
  console.log(c)

});

function xor_sum(x) {
  // 奇数なら
  if (x & 1) { return (odd(x)) }
  // 偶数なら
  else {
    if (odd(x + 1) & 1) { return (x + 1 - 1) }
    else { return (x + 1) }
  }
}

function odd(x) { return ((x + 1) / 2 % 2) }