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

c = B - A + 1

def bit_cnt(n)
  l = n.to_s(2).size
  result = Hash.new(0)
  return result if n < 0

  result[0] = (n + 1) / 2
  i = 1
  v = 2
  t = 4

  (1..l).each do |i|
    result[i] = v * (n / t) + [n % t - ((2 ** i) - 1), 0].max

    v *= 2
    t *= 2
  end

  result
end

a_h = bit_cnt(A - 1)
b_h = bit_cnt(B)

l = B.to_s(2).size

puts (0..l).map { |i| (b_h[i] - a_h[i]).odd? ? '1' : '0' }.reverse.join.to_i(2)

__END__
1 = (c + 1) / 2
2 = 2 * (c / 4) + [c % 4 - 1, 0].max
3 = 4 * (c / 8) + [c % 8 - 3, 0].max
4 = 8 * (c / 16) + [c % 16 - 7, 0].max
n = (2 ** i) * (c / (2 ** i)) + [c / 

