def xor_from_zero(to):
    fr = 0
    to_copy = to
    b = 2 ** (len(format(to, 'b'))-1)
    while b > 2:
        if to_copy // b > 0:
            fr += b
            to_copy -= b

        b = b // 2

    res = 0
    for a in range(fr, to+1):
        res = res ^ a

    return res

A, B = map(int, input().split())
print(xor_from_zero(A-1)^xor_from_zero(B)) def xor_from_zero(to):
    fr = 0
    to_copy = to
    b = 2 ** (len(format(to, 'b'))-1)
    while b > 2:
        if to_copy // b > 0:
            fr += b
            to_copy -= b

        b = b // 2

    res = 0
    for a in range(fr, to+1):
        res = res ^ a

    return res xor_from_zero fr = 0 fr 0 to_copy = to to_copy to b = 2 ** (len(format(to, 'b'))-1) b 2 ** (len(format(to, 'b'))-1) 2 len(format(to, 'b'))-1 len(format(to, 'b')) len format(to, 'b') format to 'b' 1 while b > 2:
        if to_copy // b > 0:
            fr += b
            to_copy -= b

        b = b // 2

     b > 2 b 2 if to_copy // b > 0:
            fr += b
            to_copy -= b

         to_copy // b > 0 to_copy // b to_copy b 0 fr += b fr b to_copy -= b to_copy b b = b // 2 b b // 2 b 2 res = 0 res 0 for a in range(fr, to+1):
        res = res ^ a

     a range(fr, to+1) range fr to+1 to 1 res = res ^ a res res ^ a res a return res res to to A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B print(xor_from_zero(A-1)^xor_from_zero(B)) print xor_from_zero(A-1)^xor_from_zero(B) xor_from_zero(A-1) xor_from_zero A-1 A 1 xor_from_zero(B) xor_from_zero B def xor_from_zero(to):
    fr = 0
    to_copy = to
    b = 2 ** (len(format(to, 'b'))-1)
    while b > 2:
        if to_copy // b > 0:
            fr += b
            to_copy -= b

        b = b // 2

    res = 0
    for a in range(fr, to+1):
        res = res ^ a

    return res def xor_from_zero(to):
    fr = 0
    to_copy = to
    b = 2 ** (len(format(to, 'b'))-1)
    while b > 2:
        if to_copy // b > 0:
            fr += b
            to_copy -= b

        b = b // 2

    res = 0
    for a in range(fr, to+1):
        res = res ^ a

    return res xor_from_zero A, B = map(int, input().split()) map(int, input().split()) A B = map(int, input().split()) map(int, input().split()) B
def xor_from_zero(to):
    fr = 0
    to_copy = to
    b = 2 ** (len(format(to, 'b'))-1)
    while b > 2:
        if to_copy // b > 0:
            fr += b
            to_copy -= b

        b = b // 2

    res = 0
    for a in range(fr, to+1):
        res = res ^ a

    return res

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