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;

long calc(long a, long b) {
    if (a == b) return a;

    if (a % 2 == 0) {
        if (b % 2 == 0) {
            if ((b - a) / 2 % 2 == 0) return b;
            return b ^ 1;
        }

        if ((b - a + 1) / 2 % 2 == 0) return 0;
        return 1;
    }
    else {
        return a ^ calc(a + 1, b);
    }
}

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