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

# 0^1^...^number
def calc(number)
  return 0 if number <= 0

  number += 1

  res = 0
  0.upto(50) do |i|
    base = 2 ** (i + 1)
    number_of_1 = (number / base) * base / 2
    number_of_1 += [0, number % base - (base / 2)].max

    if number_of_1 % 2 == 1
      res += 2 ** i
    end
  end

  res
end

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