

def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def f(B):
    '''
    000  = 1   = 0
    001
    010  = 1
    011
    100  = 1
    101
    '''
    B += 1
    if B%4 == 0:
        return 0
    if B%4 == 1:
        return B-1
    if B%4 == 2:
        return 1
    return (B-1)^1


def solve():
    A, B = read_ints()
    return f(A-1)^f(B)


if __name__ == '__main__':
    print(solve()) def read_int():
    return int(input().strip()) read_int return int(input().strip()) int(input().strip()) int input().strip() ().strip () input strip def read_ints():
    return list(map(int, input().strip().split(' '))) read_ints return list(map(int, input().strip().split(' '))) list(map(int, input().strip().split(' '))) list map(int, input().strip().split(' ')) map int input().strip().split(' ') ().strip().split ().strip() ().strip () input strip split ' ' def f(B):
    '''
    000  = 1   = 0
    001
    010  = 1
    011
    100  = 1
    101
    '''
    B += 1
    if B%4 == 0:
        return 0
    if B%4 == 1:
        return B-1
    if B%4 == 2:
        return 1
    return (B-1)^1 f '''
    000  = 1   = 0
    001
    010  = 1
    011
    100  = 1
    101
    ''' B += 1 B 1 if B%4 == 0:
        return 0
     B%4 == 0 B%4 B 4 0 return 0 0 if B%4 == 1:
        return B-1
     B%4 == 1 B%4 B 4 1 return B-1 B-1 B 1 if B%4 == 2:
        return 1
     B%4 == 2 B%4 B 4 2 return 1 1 return (B-1)^1 (B-1)^1 B-1 B 1 1 B B def solve():
    A, B = read_ints()
    return f(A-1)^f(B) solve A, B = read_ints() A read_ints() read_ints B return f(A-1)^f(B) f(A-1)^f(B) f(A-1) f A-1 A 1 f(B) f B if __name__ == '__main__':
    print(solve()) __name__ == '__main__' __name__ '__main__' print(solve()) print solve() solve def read_ints():
    return list(map(int, input().strip().split(' '))) def read_ints():
    return list(map(int, input().strip().split(' '))) read_ints def read_int():
    return int(input().strip()) def read_int():
    return int(input().strip()) read_int def solve():
    A, B = read_ints()
    return f(A-1)^f(B) def solve():
    A, B = read_ints()
    return f(A-1)^f(B) solve def f(B):
    '''
    000  = 1   = 0
    001
    010  = 1
    011
    100  = 1
    101
    '''
    B += 1
    if B%4 == 0:
        return 0
    if B%4 == 1:
        return B-1
    if B%4 == 2:
        return 1
    return (B-1)^1 def f(B):
    '''
    000  = 1   = 0
    001
    010  = 1
    011
    100  = 1
    101
    '''
    B += 1
    if B%4 == 0:
        return 0
    if B%4 == 1:
        return B-1
    if B%4 == 2:
        return 1
    return (B-1)^1 f


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def f(B):
    '''
    000  = 1   = 0
    001
    010  = 1
    011
    100  = 1
    101
    '''
    B += 1
    if B%4 == 0:
        return 0
    if B%4 == 1:
        return B-1
    if B%4 == 2:
        return 1
    return (B-1)^1


def solve():
    A, B = read_ints()
    return f(A-1)^f(B)


if __name__ == '__main__':
    print(solve())
