"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 = A++;
    while (A <= B) {
        ans ^= A++;
    }
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
