import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    a,b=map(int,input().split())
    x=(((b-1)//2)-(a-1)//2)%2
    if a%2==0:
        if b%2==0:print(x^b)
        else:print(x)
    else:
        if b%2==0:print(a^x^b)
        else:print(a^x)

if __name__=='__main__':
    main() import sys sys def input(): return sys.stdin.readline().rstrip() input def main():
    a,b=map(int,input().split())
    x=(((b-1)//2)-(a-1)//2)%2
    if a%2==0:
        if b%2==0:print(x^b)
        else:print(x)
    else:
        if b%2==0:print(a^x^b)
        else:print(a^x) main a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b x=(((b-1)//2)-(a-1)//2)%2 x (((b-1)//2)-(a-1)//2)%2 ((b-1)//2)-(a-1)//2 (b-1)//2 b-1 b 1 2 (a-1)//2 a-1 a 1 2 2 if a%2==0:
        if b%2==0:print(x^b)
        else:print(x)
    else:
        if b%2==0:print(a^x^b)
        else:print(a^x) a%2==0 a%2 a 2 0 if b%2==0:print(x^b)
        else:print(x)
     b%2==0 b%2 b 2 0 if b%2==0:print(a^x^b)
        else:print(a^x) b%2==0 b%2 b 2 0 if __name__=='__main__':
    main() __name__=='__main__' __name__ '__main__' main() main def main():
    a,b=map(int,input().split())
    x=(((b-1)//2)-(a-1)//2)%2
    if a%2==0:
        if b%2==0:print(x^b)
        else:print(x)
    else:
        if b%2==0:print(a^x^b)
        else:print(a^x) def main():
    a,b=map(int,input().split())
    x=(((b-1)//2)-(a-1)//2)%2
    if a%2==0:
        if b%2==0:print(x^b)
        else:print(x)
    else:
        if b%2==0:print(a^x^b)
        else:print(a^x) main def input(): return sys.stdin.readline().rstrip() def input(): return sys.stdin.readline().rstrip() input
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    a,b=map(int,input().split())
    x=(((b-1)//2)-(a-1)//2)%2
    if a%2==0:
        if b%2==0:print(x^b)
        else:print(x)
    else:
        if b%2==0:print(a^x^b)
        else:print(a^x)

if __name__=='__main__':
    main()