a, b = $stdin.readline.split(" ").map(&:to_i)

if b == a
  puts a
elsif b - a < 100
  ((a+1)..b).each do |i|
    a ^= i
  end
  puts a
else
  as = (a...(a/4.0).ceil * 4).to_a
  bs = (((b/4.0).floor * 4)...b).to_a
  if as.empty? then as = [a] end
  if bs.empty? then bs = [b] end
  puts (as + bs).reduce(&:^)
end


