a,b = map(int,input().split())

def calc(x):
    l = len(format(x,'b'))
    s = '1' if x%4==1 or x%4==2 else '0'
    for i in range(1,l):
        x_ = x
        x_ -= 2**i-1
        mod = x_ % (2**(i+1))
        if mod >= 2**i:
            s += '0'
        else:
            if mod%2==0:
                s += '0'
            else:
                s += '1'
    s = s[::-1]
    return s

suma = int(calc(a-1),2)
sumb = int(calc(b),2)
print(int(suma^sumb)) a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b def calc(x):
    l = len(format(x,'b'))
    s = '1' if x%4==1 or x%4==2 else '0'
    for i in range(1,l):
        x_ = x
        x_ -= 2**i-1
        mod = x_ % (2**(i+1))
        if mod >= 2**i:
            s += '0'
        else:
            if mod%2==0:
                s += '0'
            else:
                s += '1'
    s = s[::-1]
    return s calc l = len(format(x,'b')) l len(format(x,'b')) len format(x,'b') format x 'b' s = '1' if x%4==1 or x%4==2 else '0' s '1' if x%4==1 or x%4==2 else '0' x%4==1 or x%4==2 x%4==1 x%4 x 4 1 x%4==2 x%4 x 4 2 '1' '0' for i in range(1,l):
        x_ = x
        x_ -= 2**i-1
        mod = x_ % (2**(i+1))
        if mod >= 2**i:
            s += '0'
        else:
            if mod%2==0:
                s += '0'
            else:
                s += '1'
     i range(1,l) range 1 l x_ = x x_ x x_ -= 2**i-1 x_ 2**i-1 2**i 2 i 1 mod = x_ % (2**(i+1)) mod x_ % (2**(i+1)) x_ 2**(i+1) 2 i+1 i 1 if mod >= 2**i:
            s += '0'
        else:
            if mod%2==0:
                s += '0'
            else:
                s += '1'
     mod >= 2**i mod 2**i 2 i s += '0' s '0' if mod%2==0:
                s += '0'
            else:
                s += '1'
     mod%2==0 mod%2 mod 2 0 s += '0' s '0' s += '1' s '1' s = s[::-1] s s[::-1] s ::-1 -1 return s s x x suma = int(calc(a-1),2) suma int(calc(a-1),2) int calc(a-1) calc a-1 a 1 2 sumb = int(calc(b),2) sumb int(calc(b),2) int calc(b) calc b 2 print(int(suma^sumb)) print int(suma^sumb) int suma^sumb suma sumb b = map(int,input().split()) map(int,input().split()) b sumb = int(calc(b),2) int(calc(b),2) sumb a,b = map(int,input().split()) map(int,input().split()) a suma = int(calc(a-1),2) int(calc(a-1),2) suma def calc(x):
    l = len(format(x,'b'))
    s = '1' if x%4==1 or x%4==2 else '0'
    for i in range(1,l):
        x_ = x
        x_ -= 2**i-1
        mod = x_ % (2**(i+1))
        if mod >= 2**i:
            s += '0'
        else:
            if mod%2==0:
                s += '0'
            else:
                s += '1'
    s = s[::-1]
    return s def calc(x):
    l = len(format(x,'b'))
    s = '1' if x%4==1 or x%4==2 else '0'
    for i in range(1,l):
        x_ = x
        x_ -= 2**i-1
        mod = x_ % (2**(i+1))
        if mod >= 2**i:
            s += '0'
        else:
            if mod%2==0:
                s += '0'
            else:
                s += '1'
    s = s[::-1]
    return s calc
a,b = map(int,input().split())

def calc(x):
    l = len(format(x,'b'))
    s = '1' if x%4==1 or x%4==2 else '0'
    for i in range(1,l):
        x_ = x
        x_ -= 2**i-1
        mod = x_ % (2**(i+1))
        if mod >= 2**i:
            s += '0'
        else:
            if mod%2==0:
                s += '0'
            else:
                s += '1'
    s = s[::-1]
    return s

suma = int(calc(a-1),2)
sumb = int(calc(b),2)
print(int(suma^sumb))