a, b = map(int, input().split())
def calc(x):
    rtn = 0
    i = 1
    while i<=x:
        i *= 2
        if i==2:
            if x%4==1 or x%4==2:
                rtn += 1
            continue
        if x%i<i//2:
            continue
        rtn += ((x%i-i//2+1)%2)*(i//2)
    return rtn
if a==0:
    print(calc(b))
else:
    print(calc(a-1)^calc(b)) a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b def calc(x):
    rtn = 0
    i = 1
    while i<=x:
        i *= 2
        if i==2:
            if x%4==1 or x%4==2:
                rtn += 1
            continue
        if x%i<i//2:
            continue
        rtn += ((x%i-i//2+1)%2)*(i//2)
    return rtn calc rtn = 0 rtn 0 i = 1 i 1 while i<=x:
        i *= 2
        if i==2:
            if x%4==1 or x%4==2:
                rtn += 1
            continue
        if x%i<i//2:
            continue
        rtn += ((x%i-i//2+1)%2)*(i//2)
     i<=x i x i *= 2 i 2 if i==2:
            if x%4==1 or x%4==2:
                rtn += 1
            continue
         i==2 i 2 if x%4==1 or x%4==2:
                rtn += 1
             x%4==1 or x%4==2 x%4==1 x%4 x 4 1 x%4==2 x%4 x 4 2 rtn += 1 rtn 1 continue if x%i<i//2:
            continue
         x%i<i//2 x%i x i i//2 i 2 continue rtn += ((x%i-i//2+1)%2)*(i//2) rtn ((x%i-i//2+1)%2)*(i//2) (x%i-i//2+1)%2 x%i-i//2+1 x%i-i//2 x%i x i i//2 i 2 1 2 i//2 i 2 return rtn rtn x x if a==0:
    print(calc(b))
else:
    print(calc(a-1)^calc(b)) a==0 a 0 print(calc(b)) print calc(b) calc b print(calc(a-1)^calc(b)) print calc(a-1)^calc(b) calc(a-1) calc a-1 a 1 calc(b) calc b b = map(int, input().split()) map(int, input().split()) b a, b = map(int, input().split()) map(int, input().split()) a def calc(x):
    rtn = 0
    i = 1
    while i<=x:
        i *= 2
        if i==2:
            if x%4==1 or x%4==2:
                rtn += 1
            continue
        if x%i<i//2:
            continue
        rtn += ((x%i-i//2+1)%2)*(i//2)
    return rtn def calc(x):
    rtn = 0
    i = 1
    while i<=x:
        i *= 2
        if i==2:
            if x%4==1 or x%4==2:
                rtn += 1
            continue
        if x%i<i//2:
            continue
        rtn += ((x%i-i//2+1)%2)*(i//2)
    return rtn calc
a, b = map(int, input().split())
def calc(x):
    rtn = 0
    i = 1
    while i<=x:
        i *= 2
        if i==2:
            if x%4==1 or x%4==2:
                rtn += 1
            continue
        if x%i<i//2:
            continue
        rtn += ((x%i-i//2+1)%2)*(i//2)
    return rtn
if a==0:
    print(calc(b))
else:
    print(calc(a-1)^calc(b))