///////////////////////////////////////////////////////////////////////////////

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <typeinfo>

using namespace std;

///////////////////////////////////////////////////////////////////////////////

#define pb push_back

struct T2 {
        long t0;
        long t1;
};

struct T3 {
        long t0;
        long t1;
        long t2;
};

struct T4 {
        long t0;
        long t1;
        long t2;
        long t3;
};

bool operator<(const T2 &lhs, const T2 &rhs)
{
        if (lhs.t0 != rhs.t0) return lhs.t0 < rhs.t0;
        return lhs.t1 < rhs.t1;
}

bool operator>(const T2 &lhs, const T2 &rhs)
{
        if (lhs.t0 != rhs.t0) return lhs.t0 > rhs.t0;
        return lhs.t1 > rhs.t1;
}

bool operator==(const T2 &lhs, const T2 &rhs)
{
        if (lhs.t0 != rhs.t0) return false;
        return lhs.t1 == rhs.t1;
}

bool operator!=(const T2 &lhs, const T2 &rhs)
{
        return !(lhs == rhs);
}

bool operator<(const T3 &lhs, const T3 &rhs)
{
        if (lhs.t0 != rhs.t0) return lhs.t0 < rhs.t0;
        if (lhs.t1 != rhs.t1) return lhs.t1 < rhs.t1;
        return lhs.t2 < rhs.t2;
}

bool operator>(const T3 &lhs, const T3 &rhs)
{
        if (lhs.t0 != rhs.t0) return lhs.t0 > rhs.t0;
        if (lhs.t1 != rhs.t1) return lhs.t1 > rhs.t1;
        return lhs.t2 > rhs.t2;
}

bool operator==(const T3 &lhs, const T3 &rhs)
{
        if (lhs.t0 != rhs.t0) return false;
        if (lhs.t1 != rhs.t1) return false;
        return lhs.t2 == rhs.t2;
}

bool operator!=(const T3 &lhs, const T3 &rhs)
{
        return !(lhs == rhs);
}

bool operator<(const T4 &lhs, const T4 &rhs)
{
        if (lhs.t0 != rhs.t0) return lhs.t0 < rhs.t0;
        if (lhs.t1 != rhs.t1) return lhs.t1 < rhs.t1;
        if (lhs.t2 != rhs.t2) return lhs.t2 < rhs.t2;
        return lhs.t3 < rhs.t3;
}

bool operator>(const T4 &lhs, const T4 &rhs)
{
        if (lhs.t0 != rhs.t0) return lhs.t0 > rhs.t0;
        if (lhs.t1 != rhs.t1) return lhs.t1 > rhs.t1;
        if (lhs.t2 != rhs.t2) return lhs.t2 > rhs.t2;
        return lhs.t3 > rhs.t3;
}

bool operator==(const T4 &lhs, const T4 &rhs)
{
        if (lhs.t0 != rhs.t0) return false;
        if (lhs.t1 != rhs.t1) return false;
        if (lhs.t2 != rhs.t2) return false;
        return lhs.t3 == rhs.t3;
}

bool operator!=(const T4 &lhs, const T4 &rhs)
{
        return !(lhs == rhs);
}

void longin(long &a)
{
        cin >> a;
}

void longinl1(auto &v, long count)
{
        for (long i = 0; i < count ; ++i) {
                long a;
                cin >> a;
                v.push_back(a);
        }
}

void longinl2(auto &v, long count)
{
        for (long i = 0; i < count ; ++i) {
                long a, b;
                cin >> a >> b;
                v.push_back({a, b});
        }
}

void longinl3(auto &v, long count)
{
        for (long i = 0; i < count ; ++i) {
                long a, b, c;
                cin >> a >> b >> c;
                v.push_back({a, b, c});
        }
}

void longina(auto &v, long count)
{
        longinl1(v, count);
}

long min(const vector<long> v)
{
        long ret = (long)numeric_limits<double>::infinity();
        for (auto i : v) ret = min(ret, i);
        return ret;
}

void sort(vector<long> &v)
{
        sort(v.begin(), v.end());
}

void sort_reverse(vector<long> &v)
{
        sort(v.begin(), v.end(), greater<long>());
}

///////////////////////////////////////////////////////////////////////////////

unsigned long acum_xor(long x)
{
        unsigned long ret = 0;

        // bit 0
        if (x % 4 == 1L || x % 4 == 2L) ret = 1;

        x++;

        for (long i = 1L; x>>i; ++i) {
                long y = x % (1L<<(i+1L));
                if (y & 1L && y >= 1L<<i) ret |= (1L<<i);
        }

        return ret;
}

int main()
{
        long a, b;
        longin(a); longin(b);

        cout << (acum_xor(max(0L, a - 1)) ^ acum_xor(b)) << endl;

        return 0;
}

///////////////////////////////////////////////////////////////////////////////


Measured memory_bytes: 256