def read_i
  gets.chomp.split(' ').map(&:to_i)
end

def from_zero(n)
  if n % 2 == 0
    (n / 2 % 2) ^ n
  else
    ((n - 1 / 2) % 2)
  end
end

def f(a, b)
  return a if a == b
  from_zero(a-1) ^ from_zero(b)
end

a, b = read_i
puts f(a, b)