def count_bits(num, digit)
  div = 2 ** (digit - 1)
  d = num / div
  v = (d / 2) * div
  v += num % div + 1 if d % 2 == 1
  v
end

def xor_world(a, b)
  length = (10 ** 13).to_s(2).size

  a -= 1 if a > 0

  a_bits = {}
  1.upto(length) do |digit|
    a_bits[digit] = count_bits(a, digit)
  end

  b_bits = {}
  1.upto(length) do |digit|
    b_bits[digit] = count_bits(b, digit)
  end

  ans = 0
  1.upto(length) do |digit|
    ans += 2 ** (digit - 1) * ((b_bits[digit] - a_bits[digit]) % 2)
  end
  ans
end

a, b = gets.split.map(&:to_i)
puts xor_world(a, b)