#include <iostream>
using namespace std;
long long xorTo(long long x) {
if (x % 4 == 0) return x;
if (x % 4 == 1) return 1;
if (x % 4 == 2) return x + 1;
return 0;
}
int main() {
long long A, B;
cin >> A >> B;
long long result = xorTo(B) ^ xorTo(A - 1);
cout << result << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKbG9uZyBsb25nIHhvclRvKGxvbmcgbG9uZyB4KSB7CiAgICBpZiAoeCAlIDQgPT0gMCkgcmV0dXJuIHg7CiAgICBpZiAoeCAlIDQgPT0gMSkgcmV0dXJuIDE7CiAgICBpZiAoeCAlIDQgPT0gMikgcmV0dXJuIHggKyAxOwogICAgcmV0dXJuIDA7Cn0KCmludCBtYWluKCkgewogICAgbG9uZyBsb25nIEEsIEI7CiAgICBjaW4gPj4gQSA+PiBCOwogICAgCiAgICBsb25nIGxvbmcgcmVzdWx0ID0geG9yVG8oQikgXiB4b3JUbyhBIC0gMSk7CiAgICAKICAgIGNvdXQgPDwgcmVzdWx0IDw8IGVuZGw7CiAgICByZXR1cm4gMDsKfQo=