A, B = gets.split.map(&:to_i).minmax a = A.bit_length - 1 b = B.bit_length - 1 if a < b puts A else puts 2 ** a - 1 end