require 'pp'

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

def calc(x)
  return 0 if x < 0
  sum = 0
  50.times do |d|
    t = 2**(d+1)
    count = (x+1)/t * t/2
    count += [0, (x+1)%t - t/2].max
    #pp [d,t,count]
    if count % 2 == 1
      sum += (1 << d)
    end
  end
  sum
end

puts calc(B) ^ calc(A-1)

