import Data.Bits
f a = if mod a 2 == 1 then if mod (a+1) 4 == 2 then 1 else 0 else if mod (div a 2) 2 == 1 then xor a 1 else a
main=do
 [a,b]<-map read.words<$>getLine ::IO[Int]
 print$xor (f b) (f (a-1))