a, b = gets.split.map(&:to_i)
if a == b
  puts a
  exit
end
bits = []
0.upto(12) do |i|
  bits[i] = (b / (2 ** (i + 1)) - [a - 1, 0].max / (2 ** (i + 1))).even? ? 0 : 1
end
puts bits.reverse.join.to_i(2) * 2 + 1
