a,b=map(int,input().split())
if a%2==0:
    if b%2==0:
        use=((b-a)//2)%2
        print(use^b) 
    else:
        use=((b-a+1)//2)%2
        print(use)
else:
    temp=a 
    a+=1
    if b%2==0:
        use=((b-a)//2)%2
        print(temp^use^b) 
    else:
        use=((b-a+1)//2)%2
        print(temp^use)    a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b if a%2==0:
    if b%2==0:
        use=((b-a)//2)%2
        print(use^b) 
    else:
        use=((b-a+1)//2)%2
        print(use)
else:
    temp=a 
    a+=1
    if b%2==0:
        use=((b-a)//2)%2
        print(temp^use^b) 
    else:
        use=((b-a+1)//2)%2
        print(temp^use)    a%2==0 a%2 a 2 0 if b%2==0:
        use=((b-a)//2)%2
        print(use^b) 
    else:
        use=((b-a+1)//2)%2
        print(use) b%2==0 b%2 b 2 0 use=((b-a)//2)%2 use ((b-a)//2)%2 (b-a)//2 b-a b a 2 2 print(use^b) print use^b use b use=((b-a+1)//2)%2 use ((b-a+1)//2)%2 (b-a+1)//2 b-a+1 b-a b a 1 2 2 print(use) print use temp=a temp a a+=1 a 1 if b%2==0:
        use=((b-a)//2)%2
        print(temp^use^b) 
    else:
        use=((b-a+1)//2)%2
        print(temp^use)    b%2==0 b%2 b 2 0 use=((b-a)//2)%2 use ((b-a)//2)%2 (b-a)//2 b-a b a 2 2 print(temp^use^b) print temp^use^b temp^use temp use b use=((b-a+1)//2)%2 use ((b-a+1)//2)%2 (b-a+1)//2 b-a+1 b-a b a 1 2 2 print(temp^use) print temp^use temp use use=((b-a)//2)%2 ((b-a)//2)%2 use temp=a a temp a+=1 1 a use=((b-a+1)//2)%2 ((b-a+1)//2)%2 use a,b=map(int,input().split()) map(int,input().split()) a b=map(int,input().split()) map(int,input().split()) b use=((b-a)//2)%2 ((b-a)//2)%2 use use=((b-a+1)//2)%2 ((b-a+1)//2)%2 use
a,b=map(int,input().split())
if a%2==0:
    if b%2==0:
        use=((b-a)//2)%2
        print(use^b) 
    else:
        use=((b-a+1)//2)%2
        print(use)
else:
    temp=a 
    a+=1
    if b%2==0:
        use=((b-a)//2)%2
        print(temp^use^b) 
    else:
        use=((b-a+1)//2)%2
        print(temp^use)   