#coding:utf-8
import sys,os
from collections import defaultdict, deque
from math import gcd, ceil, floor
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    MOD = 10**9+7

    A,B = LMIIS()
    if A & 1:
        if B & 1:
            #A, (A+1 A+2).....(B-1,B)
            print(A^(B-A)//2%2)
        else:
            #A, (A+1 A+2).....(B-2,B-1),B
            print(A^((B-A-1)//2%2)^B)
    else:
        if B & 1:
            #(A, A+1).....(B-1,B)
            print((B-A+1)//2%2)
        else:
            #(A, A+1).....(B-2,B-1),B
            print((B-A)//2%2^B)



    

if __name__ == '__main__':
    main() import sys,os sys os from collections import defaultdict, deque from math import gcd, ceil, floor sys.setrecursionlimit(10**6) sys.setrecursionlimit sys setrecursionlimit 10**6 10 6 write = sys.stdout.write write sys.stdout.write sys.stdout sys stdout write dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0 dbg (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0 'TERM_PROGRAM' in os.environ 'TERM_PROGRAM' os.environ os environ lambda *something: print(*something) print(*something) print *something something *something lambda *x: 0 0 *x def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    MOD = 10**9+7

    A,B = LMIIS()
    if A & 1:
        if B & 1:
            #A, (A+1 A+2).....(B-1,B)
            print(A^(B-A)//2%2)
        else:
            #A, (A+1 A+2).....(B-2,B-1),B
            print(A^((B-A-1)//2%2)^B)
    else:
        if B & 1:
            #(A, A+1).....(B-1,B)
            print((B-A+1)//2%2)
        else:
            #(A, A+1).....(B-2,B-1),B
            print((B-A)//2%2^B)



     main input = lambda: given().rstrip() input lambda: given().rstrip() given().rstrip() ().rstrip () given rstrip LMIIS = lambda: list(map(int,input().split())) LMIIS lambda: list(map(int,input().split())) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split II = lambda: int(input()) II lambda: int(input()) int(input()) int input() input MOD = 10**9+7 MOD 10**9+7 10**9 10 9 7 A,B = LMIIS() A LMIIS() LMIIS B if A & 1:
        if B & 1:
            #A, (A+1 A+2).....(B-1,B)
            print(A^(B-A)//2%2)
        else:
            #A, (A+1 A+2).....(B-2,B-1),B
            print(A^((B-A-1)//2%2)^B)
    else:
        if B & 1:
            #(A, A+1).....(B-1,B)
            print((B-A+1)//2%2)
        else:
            #(A, A+1).....(B-2,B-1),B
            print((B-A)//2%2^B)



     A & 1 A 1 if B & 1:
            #A, (A+1 A+2).....(B-1,B)
            print(A^(B-A)//2%2)
        else:
            #A, (A+1 A+2).....(B-2,B-1),B
            print(A^((B-A-1)//2%2)^B)
     B & 1 B 1 print(A^(B-A)//2%2) print A^(B-A)//2%2 A (B-A)//2%2 (B-A)//2 B-A B A 2 2 print(A^((B-A-1)//2%2)^B) print A^((B-A-1)//2%2)^B A^((B-A-1)//2%2) A (B-A-1)//2%2 (B-A-1)//2 B-A-1 B-A B A 1 2 2 B if B & 1:
            #(A, A+1).....(B-1,B)
            print((B-A+1)//2%2)
        else:
            #(A, A+1).....(B-2,B-1),B
            print((B-A)//2%2^B)



     B & 1 B 1 print((B-A+1)//2%2) print (B-A+1)//2%2 (B-A+1)//2 B-A+1 B-A B A 1 2 2 print((B-A)//2%2^B) print (B-A)//2%2^B (B-A)//2%2 (B-A)//2 B-A B A 2 2 B given=sys.stdin.readline given sys.stdin.readline sys.stdin sys stdin readline if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0 (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0 dbg def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    MOD = 10**9+7

    A,B = LMIIS()
    if A & 1:
        if B & 1:
            #A, (A+1 A+2).....(B-1,B)
            print(A^(B-A)//2%2)
        else:
            #A, (A+1 A+2).....(B-2,B-1),B
            print(A^((B-A-1)//2%2)^B)
    else:
        if B & 1:
            #(A, A+1).....(B-1,B)
            print((B-A+1)//2%2)
        else:
            #(A, A+1).....(B-2,B-1),B
            print((B-A)//2%2^B)



     def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    MOD = 10**9+7

    A,B = LMIIS()
    if A & 1:
        if B & 1:
            #A, (A+1 A+2).....(B-1,B)
            print(A^(B-A)//2%2)
        else:
            #A, (A+1 A+2).....(B-2,B-1),B
            print(A^((B-A-1)//2%2)^B)
    else:
        if B & 1:
            #(A, A+1).....(B-1,B)
            print((B-A+1)//2%2)
        else:
            #(A, A+1).....(B-2,B-1),B
            print((B-A)//2%2^B)



     main write = sys.stdout.write sys.stdout.write write
#coding:utf-8
import sys,os
from collections import defaultdict, deque
from math import gcd, ceil, floor
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    MOD = 10**9+7

    A,B = LMIIS()
    if A & 1:
        if B & 1:
            #A, (A+1 A+2).....(B-1,B)
            print(A^(B-A)//2%2)
        else:
            #A, (A+1 A+2).....(B-2,B-1),B
            print(A^((B-A-1)//2%2)^B)
    else:
        if B & 1:
            #(A, A+1).....(B-1,B)
            print((B-A+1)//2%2)
        else:
            #(A, A+1).....(B-2,B-1),B
            print((B-A)//2%2^B)



    

if __name__ == '__main__':
    main()