"use strict";
function Main(input) {
    let lines = input.split("\n");
    let Ln = lines.shift().split(/\s/).map((v) => v - 0);
    let a = Ln[0], b = Ln[1];
    let ans = b;
    for(let i = a; i % 4 && i < b; i++) {
        ans ^= i;
    }
    for(let i = Math.floor(b/4)*4; i < b; i++) {
        ans ^= i;
    }
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));