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]);

  console.log(xor_sum(B) ^ xor_sum(A - 1))
});

function xor_sum(x) {
  // 奇数なら
  if (x & 1) { return ((x + 1) / 2) % 2 }
  // 偶数なら
  else { return (((x + 1) + 1) / 2 % 2) ^ (x + 1) }
}