def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end
 
def desc(ar) ar.sort!{|x,y|y<=>x} end #Using .sort.reverse instead decreases Exec Time but increases Memory Usage
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end


A,B = gsmi

def calc(c)
	c += 1
	bl = c.bit_length
	ans = []
	ans << c/2%2
	1.upto(bl-1) do |i|
		if c/(2**i)%2 == 0
			ans << 0
		elsif c%(2**i)%2 == 1
			ans << 1
		else
			ans << 0
		end
	end
	ans.reverse.join.to_i(2)
end

puts calc(B) ^ calc(A-1)