import Data.Bits

f2::Int->Int
f2 a
   |a <1=0
   |a `mod` 4==3=0
   |a `mod` 4==1=1
   |a `mod` 4==0=a
   |a `mod` 4==2=((a `div` 4)+1)*4-1

main = do
       e1<-getLine
       let (a:b:[])=map read (words e1)::[Int]
       print (xor (f2 (a-1)) (f2 b))