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

def f(a, b)
  x = 0
  s = e = nil
  if a.even?
    s = a
  else
    s = a + 1
    x ^= a
  end
  if b.even?
    e = b
    x ^= b
  else
    e = b - 1
  end
  count = e - s + 1
  if (count / 2).odd?
    x ^= 1
  end
  x
end

puts f(f(0, a - 1), f(0, b))
