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

def f(x)
  c = 0

  64.times do |i|
    i = i+1
    bb = x & (1<<i)

    ## 0..b
    c ^= bb == 0 ? 0 : x.even? ? bb : 0
  end
  c ^= [1,2].include?(x%4) ? 1 : 0

  c
end

puts a == 0 ? f(b) : f(b) ^ f(a-1)