import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

alias Edge = Tuple!(int, "u", int, "v");

long[] f(long x) {
    if (x == 0) {
        long[] ans = new long[](42);
        return ans;
    } else if (x == 1) {
        long[] ans = new long[](42);
        ans[0] = 1;
        return ans;
    }

    long b = x;
    long[] ans;

    if (b % 4 == 0 || b % 4 == 3) {
        ans ~= 0;
    } else {
        ans ~= 1;
    }

    foreach (i; 1..42) {
        long v = 1L << (i + 1);
        if (b % v < v / 2) {
            ans ~= 0;
        } else if (b % v % 2 == 0) {
            ans ~= 1;
        } else {
            ans ~= 0;
        }
    }

    return ans;
}

void main() {
    auto s = readln.split.map!(to!long);
    auto A = s[0];
    auto B = s[1];

    A = max(0L, A-1);
    long ans = 0;
    long[] fa = f(A);
    long[] fb = f(B);


    foreach (i; 0..fa.length) {
        ans |= (fa[i] ^ fb[i]) << i;
    }

    ans.writeln;
}
