import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto ab = readln.split.to!(long[]);
    auto A = ab[0]-1;
    auto B = ab[1];
    long[60] bs;
    foreach (long i; 0..60) {
        bs[i] += B/(1L<<(i+1))*(1L<<i) + max(0, B%(1L<<(i+1)) - ((1L<<i)-1));
        if (A > 0) bs[i] -= A/(1L<<(i+1))*(1L<<i) + max(0, A%(1L<<(i+1)) - ((1L<<i)-1));
    }
    long r;
    foreach (i; 0..60) {
        if (bs[i]&1) r |= 1L<<i;
    }
    writeln(r);
}