import sys
from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():

    #A, B = 123, 456
    A, B = in_nn()
    d = defaultdict(lambda: 0)

    n = 1
    while n <= A:
        n *= 2
        r = A % n
        #print(n, r)
        if r >= n // 2:
            d[n] = (r - n // 2) % 2

    n = 1
    while n <= B:
        n *= 2
        r = B % n
        #print(n, r)
        if r >= n // 2:
            d[n] ^= (r - n // 2 + 1) % 2

    n = 2
    ans = 0
    while n <= max(A, B):
        n *= 2
        ans += (n // 2) * d[n]

    d = (B - A + 1) % 4
    if A % 2 == 0:
        if d == 2 or d == 3:
            ans += 1
    if A % 2 == 1:
        if d == 1 or d == 2:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main() import sys sys from collections import defaultdict read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline in_n = lambda: int(readline()) in_n lambda: int(readline()) int(readline()) int readline() readline in_nn = lambda: map(int, readline().split()) in_nn lambda: map(int, readline().split()) map(int, readline().split()) map int readline().split() ().split () readline split in_s = lambda: readline().rstrip().decode('utf-8') in_s lambda: readline().rstrip().decode('utf-8') readline().rstrip().decode('utf-8') ().rstrip().decode ().rstrip() ().rstrip () readline rstrip decode 'utf-8' def main():

    #A, B = 123, 456
    A, B = in_nn()
    d = defaultdict(lambda: 0)

    n = 1
    while n <= A:
        n *= 2
        r = A % n
        #print(n, r)
        if r >= n // 2:
            d[n] = (r - n // 2) % 2

    n = 1
    while n <= B:
        n *= 2
        r = B % n
        #print(n, r)
        if r >= n // 2:
            d[n] ^= (r - n // 2 + 1) % 2

    n = 2
    ans = 0
    while n <= max(A, B):
        n *= 2
        ans += (n // 2) * d[n]

    d = (B - A + 1) % 4
    if A % 2 == 0:
        if d == 2 or d == 3:
            ans += 1
    if A % 2 == 1:
        if d == 1 or d == 2:
            ans += 1

    print(ans) main A, B = in_nn() A in_nn() in_nn B d = defaultdict(lambda: 0) d defaultdict(lambda: 0) defaultdict lambda: 0 0 n = 1 n 1 while n <= A:
        n *= 2
        r = A % n
        #print(n, r)
        if r >= n // 2:
            d[n] = (r - n // 2) % 2

     n <= A n A n *= 2 n 2 r = A % n r A % n A n if r >= n // 2:
            d[n] = (r - n // 2) % 2

     r >= n // 2 r n // 2 n 2 d[n] = (r - n // 2) % 2 d[n] d n (r - n // 2) % 2 r - n // 2 r n // 2 n 2 2 n = 1 n 1 while n <= B:
        n *= 2
        r = B % n
        #print(n, r)
        if r >= n // 2:
            d[n] ^= (r - n // 2 + 1) % 2

     n <= B n B n *= 2 n 2 r = B % n r B % n B n if r >= n // 2:
            d[n] ^= (r - n // 2 + 1) % 2

     r >= n // 2 r n // 2 n 2 d[n] ^= (r - n // 2 + 1) % 2 d[n] d n (r - n // 2 + 1) % 2 r - n // 2 + 1 r - n // 2 r n // 2 n 2 1 2 n = 2 n 2 ans = 0 ans 0 while n <= max(A, B):
        n *= 2
        ans += (n // 2) * d[n]

     n <= max(A, B) n max(A, B) max A B n *= 2 n 2 ans += (n // 2) * d[n] ans (n // 2) * d[n] n // 2 n 2 d[n] d n d = (B - A + 1) % 4 d (B - A + 1) % 4 B - A + 1 B - A B A 1 4 if A % 2 == 0:
        if d == 2 or d == 3:
            ans += 1
     A % 2 == 0 A % 2 A 2 0 if d == 2 or d == 3:
            ans += 1
     d == 2 or d == 3 d == 2 d 2 d == 3 d 3 ans += 1 ans 1 if A % 2 == 1:
        if d == 1 or d == 2:
            ans += 1

     A % 2 == 1 A % 2 A 2 1 if d == 1 or d == 2:
            ans += 1

     d == 1 or d == 2 d == 1 d 1 d == 2 d 2 ans += 1 ans 1 print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():

    #A, B = 123, 456
    A, B = in_nn()
    d = defaultdict(lambda: 0)

    n = 1
    while n <= A:
        n *= 2
        r = A % n
        #print(n, r)
        if r >= n // 2:
            d[n] = (r - n // 2) % 2

    n = 1
    while n <= B:
        n *= 2
        r = B % n
        #print(n, r)
        if r >= n // 2:
            d[n] ^= (r - n // 2 + 1) % 2

    n = 2
    ans = 0
    while n <= max(A, B):
        n *= 2
        ans += (n // 2) * d[n]

    d = (B - A + 1) % 4
    if A % 2 == 0:
        if d == 2 or d == 3:
            ans += 1
    if A % 2 == 1:
        if d == 1 or d == 2:
            ans += 1

    print(ans) def main():

    #A, B = 123, 456
    A, B = in_nn()
    d = defaultdict(lambda: 0)

    n = 1
    while n <= A:
        n *= 2
        r = A % n
        #print(n, r)
        if r >= n // 2:
            d[n] = (r - n // 2) % 2

    n = 1
    while n <= B:
        n *= 2
        r = B % n
        #print(n, r)
        if r >= n // 2:
            d[n] ^= (r - n // 2 + 1) % 2

    n = 2
    ans = 0
    while n <= max(A, B):
        n *= 2
        ans += (n // 2) * d[n]

    d = (B - A + 1) % 4
    if A % 2 == 0:
        if d == 2 or d == 3:
            ans += 1
    if A % 2 == 1:
        if d == 1 or d == 2:
            ans += 1

    print(ans) main in_s = lambda: readline().rstrip().decode('utf-8') lambda: readline().rstrip().decode('utf-8') in_s readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline in_n = lambda: int(readline()) lambda: int(readline()) in_n read = sys.stdin.buffer.read sys.stdin.buffer.read read in_nn = lambda: map(int, readline().split()) lambda: map(int, readline().split()) in_nn
import sys
from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():

    #A, B = 123, 456
    A, B = in_nn()
    d = defaultdict(lambda: 0)

    n = 1
    while n <= A:
        n *= 2
        r = A % n
        #print(n, r)
        if r >= n // 2:
            d[n] = (r - n // 2) % 2

    n = 1
    while n <= B:
        n *= 2
        r = B % n
        #print(n, r)
        if r >= n // 2:
            d[n] ^= (r - n // 2 + 1) % 2

    n = 2
    ans = 0
    while n <= max(A, B):
        n *= 2
        ans += (n // 2) * d[n]

    d = (B - A + 1) % 4
    if A % 2 == 0:
        if d == 2 or d == 3:
            ans += 1
    if A % 2 == 1:
        if d == 1 or d == 2:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()
