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

void main() {
	auto data = readln.split;
	auto A = data[0].to!long, B = data[1].to!long;
	
	long ans;
	foreach (i; 1 .. 41) {
		immutable power = 2L^^i;
		if (B < power) break;
		
		auto A_i = A - (A/power) * power, B_i = B - (B/power) * power;
		auto a = (A & power) != 0 ? 1 : 0, b = (B & power) != 0 ? 1 : 0;
		
		//writeln(A_i, B_i);
		if (A - A_i + power <= B - B_i) {
			//writeln("here1 ", ans);
			( (power-A_i)*a + (B_i+1)*b ) % 2 == 0 ? 0 : (ans += power);
			//writeln(ans);
		}
		else {
			//writeln("here2 ", ans);
			if ((A & power) != 0) (B-A+1) % 2 == 0 ? 0 : (ans += power);
			//writeln(ans);
		}
	}
	B = B - A/2 * 2, A = A - A/2 * 2;
	//writeln(A, ", , ", B);
	if (A == 1) {
		if (B%2 == 0) {
			if (B/2 % 2 == 1) ans++;
		}
		else if ((B-1)%4 != 0) {}
		else { ans++; }
	}
	else if (A == 0) {
		if (B % 2 == 1 ) {
			if ((B-1)%4 == 0) ans++;
		}
		else if (B%4 == 0) {}
		else { ans++; }
	}
	
	writeln(ans);
}
