/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Ido Kessler
 */

#pragma GCC optimize("O3")

#include <iostream>

#include <vector>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>



namespace io {
	class input_reader {
		std::istream &in;

		template<typename T>
		inline void readIntegerValue(T &f) {
			bool positive = true;
			f = 0;
			char c;
			in.get(c);
			while (c < '0' || c > '9') {
				if (c == '-') positive = false;
				in.get(c);
			}
			while (c >= '0' && c <= '9') {
				f = (f << 3) + (f << 1) + (c & 15);
				in.get(c);
			}
			if (!positive) f *= -1;
		}

	public:
		input_reader(std::istream &in) : in(in) {}

		inline void read(int &f) { readIntegerValue(f); }

		inline void read(short &f) { readIntegerValue(f); }

		inline void read(long int &f) { readIntegerValue(f); }

		inline void read(long long int &f) { readIntegerValue(f); }

		inline void read(unsigned int &f) { readIntegerValue(f); }

		inline void read(unsigned short &f) { readIntegerValue(f); }

		inline void read(unsigned long int &f) { readIntegerValue(f); }

		inline void read(unsigned long long int &f) { readIntegerValue(f); }

		template<typename T>
		inline void read(std::vector<T> &f) { for (auto &i : f) read(i); }

		template<typename T>
		inline void read(T &f) { in >> f; }

		template<typename T1, typename T2>
		inline void read(T1 &t1, T2 &t2) {
			read(t1);
			read(t2);
		}

		template<typename T1, typename T2, typename T3>
		inline void read(T1 &t1, T2 &t2, T3 &t3) {
			read(t1, t2);
			read(t3);
		}

		template<typename T1, typename T2, typename T3, typename T4>
		inline void read(T1 &t1, T2 &t2, T3 &t3, T4 &t4) {
			read(t1, t2, t3);
			read(t4);
		}

		template<typename T1, typename T2, typename T3, typename T4, typename T5>
		inline void read(T1 &t1, T2 &t2, T3 &t3, T4 &t4, T5 &t5) {
			read(t1, t2, t3, t4);
			read(t5);
		}

		template<typename T>
		inline void readArray(int n, std::vector<T> &res) {
			res.resize(n);
			for (auto &i: res) read(i);
		}

		template<typename T>
		inline void readArray(int n, T *res) { while (n--) read(*(res++)); }

		template<typename T>
		T read() {
			T t;
			read(t);
			return t;
		}

		template<typename T>
		input_reader &operator>>(T &t) {
			read(t);
			return *this;
		}
	};
}




namespace io {
	class output_writer {
		std::ostream &out;

		template<typename T>
		inline void printIntegerHelper(T x) {
			if (x >= 10) printIntegerHelper(x / 10);
			out.put(x % 10 + 48);
		}

		template<typename T>
		inline void printInteger(T x) {
			if (x < 0) out.put('-'), x = -x;
			printIntegerHelper(x);
		}

	public:
		output_writer(std::ostream &out) : out(out) {}

		inline void flush() { out.flush(); }

		inline void print(char x) { out.put(x); }

		inline void print(short x) { printInteger(x); }

		inline void print(int x) { printInteger(x); }

		inline void print(long int x) { printInteger(x); }

		inline void print(long long int x) { printInteger(x); }

		inline void print(unsigned short x) { printInteger(x); }

		inline void print(unsigned int x) { printInteger(x); }

		inline void print(unsigned long int x) { printInteger(x); }

		inline void print(unsigned long long int x) { printInteger(x); }


		template<typename T1>
		inline void print(const T1 &t1) {
			out << t1;
		}

		template<typename T1>
		inline void print(const std::vector<T1> &t1) {
			bool first = true;
			for (auto &t : t1) {
				if (first) first = false;
				else print(' ');
				print(t);
			}
		}

		template<typename T1>
		inline void print(const std::vector<std::vector<T1>> &t1) {
			for (auto &t : t1)
				println(t);
		}

		template<typename T, typename... Args>
		inline void print(const T &t, Args... args) {
			print(t);
			print(args...);
		}

		inline void println() { out.put('\n'); }

		template<typename... Args>
		inline void println(Args... args) {
			print(args...);
			println();
		}

		template<typename T>
		output_writer &operator<<(const T &t) {
			print(t);
			return *this;
		}
	};
}


#define all(x) (x).begin(), (x).end()
#define fori(i,n) for(int i = 0; i < n; i++)
#define rep(i,s,e) for(int i = (s); i <= (e); ++i)
#define repr(i,s,e) for(int i = (s); i >= (e); --i)
#define ll long long int



using namespace std;

class DXORWorld {
	void solve(io::input_reader &in, io::output_writer &out) {
		ll a, b;
		in >> a >> b;
		ll res = 0;
		ll count1_from_a_to_b = (b - a + 1) / 2;
		if ((a & 1) == (b & 1)) {
			if (a & 1) {
				count1_from_a_to_b++;
			}
		}
		res = count1_from_a_to_b % 2;
		for (int i = 1; (1ll << i) <= b; ++i) {
			ll onlyBit = 1ll << i;
			ll onlyUpper = ((1ll << 60) - 1) ^((1ll << (i + 1)) - 1);

			bool should_add_by_a = false, should_add_by_b = false;
			if (onlyBit & a) {
				ll top = onlyUpper & a;
				top |= (1ll << (i + 1)) - 1;
				ll dif = (top - a + 1) % 2;
				if (dif) should_add_by_a = true;
			}
			if (onlyBit & b) {
				ll bottom = b & onlyUpper;
				bottom |= (1ll << i);
				ll dif = (b - bottom + 1) % 2;
				if (dif) should_add_by_b = true;
			}

			ll onlyUpperWithBit = ((1ll << 60) - 1) ^((1ll << i) - 1);
			bool should_add = false;
			if ((onlyUpperWithBit & a) == (onlyUpperWithBit & b)) {
				if (a & onlyBit) {
					//then it's only about even\od;
					ll dif = b - a + 1;
					dif %= 2;
					if (dif) should_add = true;
				}
			} else {
				should_add = should_add_by_a ^ should_add_by_b;
			}

			if (should_add)
				res |= 1ll << i;
		}
		out << res;
	}

public:
	void solve(std::istream &in, std::ostream &out) {
		io::input_reader input(in);
		io::output_writer output(out);
		solve(input, output);
	}
};


int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(0);
	DXORWorld solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256