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

ans = []
if A == B 
  puts A
else
  (B - A + 1).times do
    tmp = 0
     (B - A + 1).times do |i|
        tmp += (num[i] % 2)
        num[i] /= 2
    end
    tmp %= 2
    ans << tmp
end
puts ans.reverse.join().to_i(2)
end
  