import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

// 0, 1, 2, ..., n の xor を求める
long f(long n) {
    if (n <= 0) return 0;

    long ans = 0;
    for (long i = n / 4 * 4; i <= n; i++) {
        ans ^= i;
    }
    return ans;
}

long calc(long a, long b) {
    return f(a - 1) ^ f(b);
}

void main() {
    auto ab = reads!long;
    long a = ab[0], b = ab[1];

    auto ans = calc(a, b);
    writeln(ans);
}
