# util functions

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

# input
inputs = []
lc = 0
while l = $stdin.gets do
  if false
    inputs << l.chomp.split(" ").map(&:to_s)
  else
    inputs << l.chomp.split(" ").map(&:to_i)
  end
  lc += 1
end

# input check
if $debugFlag
  p "--- INPUT (begin) ---"
  inputs.each do |l_i|
    p l_i
  end
  p "--- INPUT (end) ---"
  print "\n"
end

ll = inputs[0][0]
rr = inputs[0][1]

# body
if $debugFlag
  p ll
  p rr
end

def calc(r)
  if r[0] == 1
    return ((r+1)/2 % 2)
  else
    return ((r+1)/2 % 2) ^ r
  end
end

puts calc(ll-1) ^ calc(rr)
