# 0..aの累積XORを求める
def solve(a)
  if a.odd?
    if (a/2).odd?
      0
    else
      1
    end
  else
    if (a/2).odd?
      a+1
    else
      a
    end
  end
end

a,b = gets.split.map &:to_i
ans = a.zero? ? solve(b) : solve(b) ^ solve(a-1)
puts ans

