def g(x)
  x.even? ? ((x/2).even? ? 0 : 1)^x : (((x+1)/2).even? ? 0 : 1)
end

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

p g(B) ^ g(A-1)

# 0 ^ n = n
# n ^ n = 0
# g(n) = 0^1^...^n = f(0, n)

# g(n) = n     if n % 4 == 0
# g(n) = 1     if n % 4 == 1
# g(n) = n + 1 if n % 4 == 2
# g(n) = 0     if n % 4 == 3
# 証明は数学的帰納法かな

# f(a,b) = f(0, b) ^ f(0, a-1) = g(b) ^ g(a)