
A,B = gets.split.map(&:to_i)

sum = 0

min_keta = 2**(A.to_s(2).length)
max_keta = 2**(B.to_s(2).length-1)
if min_keta == max_keta
    min_array = (A..min_keta).to_a
    min_array.each do |num|
        sum = sum ^ num
    end
    puts sum
else
    min_array = (A..min_keta).to_a
    min_array.pop

    min_array.each do |num|
        sum = sum ^ num
    end
    max_array = (max_keta..B).to_a
    max_array.each do |num|
        sum = sum ^ num
    end
    p sum
end
