def calc(n):
    if n % 4 == 1:
        return 1
    elif n % 4 == 2:
        return 1 ^ n
    elif n % 4 == 3:
        return 0
    else:
        return 0 ^ n


A, B = map(int, input().split())
print(calc(B) ^ calc(A - 1)) def calc(n):
    if n % 4 == 1:
        return 1
    elif n % 4 == 2:
        return 1 ^ n
    elif n % 4 == 3:
        return 0
    else:
        return 0 ^ n calc if n % 4 == 1:
        return 1
    elif n % 4 == 2:
        return 1 ^ n
    elif n % 4 == 3:
        return 0
    else:
        return 0 ^ n n % 4 == 1 n % 4 n 4 1 return 1 1 elif n % 4 == 2:
        return 1 ^ n
     n % 4 == 2 n % 4 n 4 2 return 1 ^ n 1 ^ n 1 n elif n % 4 == 3:
        return 0
     n % 4 == 3 n % 4 n 4 3 return 0 0 return 0 ^ n 0 ^ n 0 n n n A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B print(calc(B) ^ calc(A - 1)) print calc(B) ^ calc(A - 1) calc(B) calc B calc(A - 1) calc A - 1 A 1 A, B = map(int, input().split()) map(int, input().split()) A def calc(n):
    if n % 4 == 1:
        return 1
    elif n % 4 == 2:
        return 1 ^ n
    elif n % 4 == 3:
        return 0
    else:
        return 0 ^ n def calc(n):
    if n % 4 == 1:
        return 1
    elif n % 4 == 2:
        return 1 ^ n
    elif n % 4 == 3:
        return 0
    else:
        return 0 ^ n calc B = map(int, input().split()) map(int, input().split()) B
def calc(n):
    if n % 4 == 1:
        return 1
    elif n % 4 == 2:
        return 1 ^ n
    elif n % 4 == 3:
        return 0
    else:
        return 0 ^ n


A, B = map(int, input().split())
print(calc(B) ^ calc(A - 1))
