a,b = map(int,input().split())

mid_xor = 0
if a%2 == 0 and b%2 == 1:
    even_cnt = (b-a+1)//2
    if even_cnt%2 == 0:
        mid_xor = 0
    else:
        mid_xor = 1
    print(mid_xor)

elif a%2 == 1 and b%2 == 0:
    even_cnt = (b-1-(a+1)+1)//2
    if even_cnt%2 == 0:
        mid_xor = 0
    else:
        mid_xor = 1
    print(a^mid_xor^b)

elif a%2 == 0 and b%2 == 0:
    even_cnt = (b-a)//2
    if even_cnt%2 == 0:
        mid_xor = 0
    else:
        mid_xor = 1
    print(mid_xor^b)
    
elif a%2 == 1 and b%2 == 1:
    even_cnt = (b-a)//2
    if even_cnt%2 == 0:
        mid_xor = 0
    else:
        mid_xor = 1
    print(a^mid_xor) a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b mid_xor = 0 mid_xor 0 if a%2 == 0 and b%2 == 1:
    even_cnt = (b-a+1)//2
    if even_cnt%2 == 0:
        mid_xor = 0
    else:
        mid_xor = 1
    print(mid_xor)

elif a%2 == 1 and b%2 == 0:
    even_cnt = (b-1-(a+1)+1)//2
    if even_cnt%2 == 0:
        mid_xor = 0
    else:
        mid_xor = 1
    print(a^mid_xor^b)

elif a%2 == 0 and b%2 == 0:
    even_cnt = (b-a)//2
    if even_cnt%2 == 0:
        mid_xor = 0
    else:
        mid_xor = 1
    print(mid_xor^b)
    
elif a%2 == 1 and b%2 == 1:
    even_cnt = (b-a)//2
    if even_cnt%2 == 0:
        mid_xor = 0
    else:
        mid_xor = 1
    print(a^mid_xor) a%2 == 0 and b%2 == 1 a%2 == 0 a%2 a 2 0 b%2 == 1 b%2 b 2 1 even_cnt = (b-a+1)//2 even_cnt (b-a+1)//2 b-a+1 b-a b a 1 2 if even_cnt%2 == 0:
        mid_xor = 0
    else:
        mid_xor = 1
     even_cnt%2 == 0 even_cnt%2 even_cnt 2 0 mid_xor = 0 mid_xor 0 mid_xor = 1 mid_xor 1 print(mid_xor) print mid_xor elif a%2 == 1 and b%2 == 0:
    even_cnt = (b-1-(a+1)+1)//2
    if even_cnt%2 == 0:
        mid_xor = 0
    else:
        mid_xor = 1
    print(a^mid_xor^b) a%2 == 1 and b%2 == 0 a%2 == 1 a%2 a 2 1 b%2 == 0 b%2 b 2 0 even_cnt = (b-1-(a+1)+1)//2 even_cnt (b-1-(a+1)+1)//2 b-1-(a+1)+1 b-1-(a+1) b-1 b 1 a+1 a 1 1 2 if even_cnt%2 == 0:
        mid_xor = 0
    else:
        mid_xor = 1
     even_cnt%2 == 0 even_cnt%2 even_cnt 2 0 mid_xor = 0 mid_xor 0 mid_xor = 1 mid_xor 1 print(a^mid_xor^b) print a^mid_xor^b a^mid_xor a mid_xor b elif a%2 == 0 and b%2 == 0:
    even_cnt = (b-a)//2
    if even_cnt%2 == 0:
        mid_xor = 0
    else:
        mid_xor = 1
    print(mid_xor^b)
     a%2 == 0 and b%2 == 0 a%2 == 0 a%2 a 2 0 b%2 == 0 b%2 b 2 0 even_cnt = (b-a)//2 even_cnt (b-a)//2 b-a b a 2 if even_cnt%2 == 0:
        mid_xor = 0
    else:
        mid_xor = 1
     even_cnt%2 == 0 even_cnt%2 even_cnt 2 0 mid_xor = 0 mid_xor 0 mid_xor = 1 mid_xor 1 print(mid_xor^b) print mid_xor^b mid_xor b elif a%2 == 1 and b%2 == 1:
    even_cnt = (b-a)//2
    if even_cnt%2 == 0:
        mid_xor = 0
    else:
        mid_xor = 1
    print(a^mid_xor) a%2 == 1 and b%2 == 1 a%2 == 1 a%2 a 2 1 b%2 == 1 b%2 b 2 1 even_cnt = (b-a)//2 even_cnt (b-a)//2 b-a b a 2 if even_cnt%2 == 0:
        mid_xor = 0
    else:
        mid_xor = 1
     even_cnt%2 == 0 even_cnt%2 even_cnt 2 0 mid_xor = 0 mid_xor 0 mid_xor = 1 mid_xor 1 print(a^mid_xor) print a^mid_xor a mid_xor a,b = map(int,input().split()) map(int,input().split()) a even_cnt = (b-1-(a+1)+1)//2 (b-1-(a+1)+1)//2 even_cnt even_cnt = (b-a)//2 (b-a)//2 even_cnt even_cnt = (b-a+1)//2 (b-a+1)//2 even_cnt mid_xor = 0 0 mid_xor mid_xor = 1 1 mid_xor mid_xor = 1 1 mid_xor mid_xor = 0 0 mid_xor mid_xor = 1 1 mid_xor mid_xor = 1 1 mid_xor even_cnt = (b-a)//2 (b-a)//2 even_cnt mid_xor = 0 0 mid_xor mid_xor = 0 0 mid_xor mid_xor = 0 0 mid_xor b = map(int,input().split()) map(int,input().split()) b
a,b = map(int,input().split())

mid_xor = 0
if a%2 == 0 and b%2 == 1:
    even_cnt = (b-a+1)//2
    if even_cnt%2 == 0:
        mid_xor = 0
    else:
        mid_xor = 1
    print(mid_xor)

elif a%2 == 1 and b%2 == 0:
    even_cnt = (b-1-(a+1)+1)//2
    if even_cnt%2 == 0:
        mid_xor = 0
    else:
        mid_xor = 1
    print(a^mid_xor^b)

elif a%2 == 0 and b%2 == 0:
    even_cnt = (b-a)//2
    if even_cnt%2 == 0:
        mid_xor = 0
    else:
        mid_xor = 1
    print(mid_xor^b)
    
elif a%2 == 1 and b%2 == 1:
    even_cnt = (b-a)//2
    if even_cnt%2 == 0:
        mid_xor = 0
    else:
        mid_xor = 1
    print(a^mid_xor)