a,b = map(int, input().split())
bis = [0] * 50
"""
- F(A,B) = F(0,B) ^ F(0,A-1)
- 2m ^ 2m+1 = 1
"""
def F(a):
    if a % 2 == 0:
        x = (a-1)//2
        return (x%2)^a
    else:
        x = a//2
        return x%2
    
ans = F(b)^F(a-1)

print((ans)) a,b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b bis = [0] * 50 bis [0] * 50 [0] 0 50 """
- F(A,B) = F(0,B) ^ F(0,A-1)
- 2m ^ 2m+1 = 1
""" def F(a):
    if a % 2 == 0:
        x = (a-1)//2
        return (x%2)^a
    else:
        x = a//2
        return x%2
     F if a % 2 == 0:
        x = (a-1)//2
        return (x%2)^a
    else:
        x = a//2
        return x%2
     a % 2 == 0 a % 2 a 2 0 x = (a-1)//2 x (a-1)//2 a-1 a 1 2 return (x%2)^a (x%2)^a x%2 x 2 a x = a//2 x a//2 a 2 return x%2 x%2 x 2 a a ans = F(b)^F(a-1) ans F(b)^F(a-1) F(b) F b F(a-1) F a-1 a 1 print((ans)) print ans ans = F(b)^F(a-1) F(b)^F(a-1) ans bis = [0] * 50 [0] * 50 bis b = map(int, input().split()) map(int, input().split()) b def F(a):
    if a % 2 == 0:
        x = (a-1)//2
        return (x%2)^a
    else:
        x = a//2
        return x%2
     def F(a):
    if a % 2 == 0:
        x = (a-1)//2
        return (x%2)^a
    else:
        x = a//2
        return x%2
     F a,b = map(int, input().split()) map(int, input().split()) a
a,b = map(int, input().split())
bis = [0] * 50
"""
- F(A,B) = F(0,B) ^ F(0,A-1)
- 2m ^ 2m+1 = 1
"""
def F(a):
    if a % 2 == 0:
        x = (a-1)//2
        return (x%2)^a
    else:
        x = a//2
        return x%2
    
ans = F(b)^F(a-1)

print((ans))