const f = (A, B) => {
    r = A;

    for (i = 1; i <= B - A; i++) {
        r = r ^ (A + i);
    }

    return r;
}

const main = input => {
    x = input.split(' ');
    console.log(f(~~x[0], ~~x[1]));
}

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