def main():
    a,b = map(int, input().split())
    n = (b-a+1)#要素数
    k = n//2

    if n%2==0:
        if a%2==0:
            if k%2==0:
                res = 0
            else:
                res =1
        else:
            k = (n-2)//2
            if k%2 == 1:
                res=(a^b^1)
            else:
                res = a^b
    else:
        if a%2 == 0:
            if k%2 == 0:
                res = (b)
            else:
                res = b^1
        else:
            if k%2==1:
                res = a^1
            else:
                res = a
    print(res)





if __name__ == '__main__':
    main() def main():
    a,b = map(int, input().split())
    n = (b-a+1)#要素数
    k = n//2

    if n%2==0:
        if a%2==0:
            if k%2==0:
                res = 0
            else:
                res =1
        else:
            k = (n-2)//2
            if k%2 == 1:
                res=(a^b^1)
            else:
                res = a^b
    else:
        if a%2 == 0:
            if k%2 == 0:
                res = (b)
            else:
                res = b^1
        else:
            if k%2==1:
                res = a^1
            else:
                res = a
    print(res) main a,b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b n = (b-a+1) n b-a+1 b-a b a 1 k = n//2 k n//2 n 2 if n%2==0:
        if a%2==0:
            if k%2==0:
                res = 0
            else:
                res =1
        else:
            k = (n-2)//2
            if k%2 == 1:
                res=(a^b^1)
            else:
                res = a^b
    else:
        if a%2 == 0:
            if k%2 == 0:
                res = (b)
            else:
                res = b^1
        else:
            if k%2==1:
                res = a^1
            else:
                res = a
     n%2==0 n%2 n 2 0 if a%2==0:
            if k%2==0:
                res = 0
            else:
                res =1
        else:
            k = (n-2)//2
            if k%2 == 1:
                res=(a^b^1)
            else:
                res = a^b
     a%2==0 a%2 a 2 0 if k%2==0:
                res = 0
            else:
                res =1
         k%2==0 k%2 k 2 0 res = 0 res 0 res =1 res 1 k = (n-2)//2 k (n-2)//2 n-2 n 2 2 if k%2 == 1:
                res=(a^b^1)
            else:
                res = a^b
     k%2 == 1 k%2 k 2 1 res=(a^b^1) res a^b^1 a^b a b 1 res = a^b res a^b a b if a%2 == 0:
            if k%2 == 0:
                res = (b)
            else:
                res = b^1
        else:
            if k%2==1:
                res = a^1
            else:
                res = a
     a%2 == 0 a%2 a 2 0 if k%2 == 0:
                res = (b)
            else:
                res = b^1
         k%2 == 0 k%2 k 2 0 res = (b) res b res = b^1 res b^1 b 1 if k%2==1:
                res = a^1
            else:
                res = a
     k%2==1 k%2 k 2 1 res = a^1 res a^1 a 1 res = a res a print(res) print res if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    a,b = map(int, input().split())
    n = (b-a+1)#要素数
    k = n//2

    if n%2==0:
        if a%2==0:
            if k%2==0:
                res = 0
            else:
                res =1
        else:
            k = (n-2)//2
            if k%2 == 1:
                res=(a^b^1)
            else:
                res = a^b
    else:
        if a%2 == 0:
            if k%2 == 0:
                res = (b)
            else:
                res = b^1
        else:
            if k%2==1:
                res = a^1
            else:
                res = a
    print(res) def main():
    a,b = map(int, input().split())
    n = (b-a+1)#要素数
    k = n//2

    if n%2==0:
        if a%2==0:
            if k%2==0:
                res = 0
            else:
                res =1
        else:
            k = (n-2)//2
            if k%2 == 1:
                res=(a^b^1)
            else:
                res = a^b
    else:
        if a%2 == 0:
            if k%2 == 0:
                res = (b)
            else:
                res = b^1
        else:
            if k%2==1:
                res = a^1
            else:
                res = a
    print(res) main
def main():
    a,b = map(int, input().split())
    n = (b-a+1)#要素数
    k = n//2

    if n%2==0:
        if a%2==0:
            if k%2==0:
                res = 0
            else:
                res =1
        else:
            k = (n-2)//2
            if k%2 == 1:
                res=(a^b^1)
            else:
                res = a^b
    else:
        if a%2 == 0:
            if k%2 == 0:
                res = (b)
            else:
                res = b^1
        else:
            if k%2==1:
                res = a^1
            else:
                res = a
    print(res)





if __name__ == '__main__':
    main()
