def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

MAX_L = 43

def main():
    A, B = ZZ()

    p = []
    e = 1
    for _ in range(MAX_L+1):
        p.append(e)
        e *= 2

    def bitc(num):
        ret = []
        for i in range(1, MAX_L+1):
            x = (num//p[i]) * p[i-1] + max(0, num%p[i]-p[i-1]+1)
            ret.append(x%2)
        return ret

    a = bitc(max(0, A-1))
    b = bitc(B)
    output = 0
    for i in range(MAX_L): output += (a[i]+b[i])%2 * p[i]
    print(output)

    return

if __name__ == '__main__':
    main() def Z(): return int(input()) Z int(_) for _ in input().split() for _ in input().split() _ input().split() ().split () input split for _ in input().split() int(_) int _ def ZZ(): return [int(_) for _ in input().split()] ZZ MAX_L = 43 MAX_L 43 def main():
    A, B = ZZ()

    p = []
    e = 1
    for _ in range(MAX_L+1):
        p.append(e)
        e *= 2

    def bitc(num):
        ret = []
        for i in range(1, MAX_L+1):
            x = (num//p[i]) * p[i-1] + max(0, num%p[i]-p[i-1]+1)
            ret.append(x%2)
        return ret

    a = bitc(max(0, A-1))
    b = bitc(B)
    output = 0
    for i in range(MAX_L): output += (a[i]+b[i])%2 * p[i]
    print(output)

    return main A, B = ZZ() A ZZ() ZZ B p = [] p [] e = 1 e 1 for _ in range(MAX_L+1):
        p.append(e)
        e *= 2

     _ range(MAX_L+1) range MAX_L+1 MAX_L 1 p.append(e) p.append p append e e *= 2 e 2 def bitc(num):
        ret = []
        for i in range(1, MAX_L+1):
            x = (num//p[i]) * p[i-1] + max(0, num%p[i]-p[i-1]+1)
            ret.append(x%2)
        return ret

     bitc ret = [] ret [] for i in range(1, MAX_L+1):
            x = (num//p[i]) * p[i-1] + max(0, num%p[i]-p[i-1]+1)
            ret.append(x%2)
         i range(1, MAX_L+1) range 1 MAX_L+1 MAX_L 1 x = (num//p[i]) * p[i-1] + max(0, num%p[i]-p[i-1]+1) x (num//p[i]) * p[i-1] + max(0, num%p[i]-p[i-1]+1) (num//p[i]) * p[i-1] num//p[i] num p[i] p i p[i-1] p i-1 i 1 max(0, num%p[i]-p[i-1]+1) max 0 num%p[i]-p[i-1]+1 num%p[i]-p[i-1] num%p[i] num p[i] p i p[i-1] p i-1 i 1 1 ret.append(x%2) ret.append ret append x%2 x 2 return ret ret num num a = bitc(max(0, A-1)) a bitc(max(0, A-1)) bitc max(0, A-1) max 0 A-1 A 1 b = bitc(B) b bitc(B) bitc B output = 0 output 0 for i in range(MAX_L): output += (a[i]+b[i])%2 * p[i]
     i range(MAX_L) range MAX_L print(output) print output return if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    A, B = ZZ()

    p = []
    e = 1
    for _ in range(MAX_L+1):
        p.append(e)
        e *= 2

    def bitc(num):
        ret = []
        for i in range(1, MAX_L+1):
            x = (num//p[i]) * p[i-1] + max(0, num%p[i]-p[i-1]+1)
            ret.append(x%2)
        return ret

    a = bitc(max(0, A-1))
    b = bitc(B)
    output = 0
    for i in range(MAX_L): output += (a[i]+b[i])%2 * p[i]
    print(output)

    return def main():
    A, B = ZZ()

    p = []
    e = 1
    for _ in range(MAX_L+1):
        p.append(e)
        e *= 2

    def bitc(num):
        ret = []
        for i in range(1, MAX_L+1):
            x = (num//p[i]) * p[i-1] + max(0, num%p[i]-p[i-1]+1)
            ret.append(x%2)
        return ret

    a = bitc(max(0, A-1))
    b = bitc(B)
    output = 0
    for i in range(MAX_L): output += (a[i]+b[i])%2 * p[i]
    print(output)

    return main def Z(): return int(input()) def Z(): return int(input()) Z def ZZ(): return [int(_) for _ in input().split()] def ZZ(): return [int(_) for _ in input().split()] ZZ MAX_L = 43 43 MAX_L
def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

MAX_L = 43

def main():
    A, B = ZZ()

    p = []
    e = 1
    for _ in range(MAX_L+1):
        p.append(e)
        e *= 2

    def bitc(num):
        ret = []
        for i in range(1, MAX_L+1):
            x = (num//p[i]) * p[i-1] + max(0, num%p[i]-p[i-1]+1)
            ret.append(x%2)
        return ret

    a = bitc(max(0, A-1))
    b = bitc(B)
    output = 0
    for i in range(MAX_L): output += (a[i]+b[i])%2 * p[i]
    print(output)

    return

if __name__ == '__main__':
    main()
