def bit(n)
  return "0" if n == 0
  b = n.bit_length
  x = ""
  b.times do |i|
    if i == 0
      if ((n+1)/2) % 2 == 1
        x = "1" + x
      else
        x = "0" + x
      end
    else
      if (n + 2**i) % (2 ** (i+1)) < 2 ** i && ((n + 2**i) % (2 ** (i+1))) % 2 == 0
        x = "1" + x
      else
        x = "0" + x
      end
    end
  end
  x
end
a,b = gets.chomp.split(" ").map(&:to_i)
if a == 0
  puts bit(b).to_i(2)
else
  puts bit(a-1).to_i(2) ^ bit(b).to_i(2)
end
