def main():
    A, B = (int(i) for i in input().split())

    def f(X):
        X += 1
        bi = []
        d = 2
        for i in range(40):
            v = (X//d) * (d//2) + max((X % d) - (d//2), 0)
            bi.append(v)
            d *= 2
        return bi

    ans = 0
    d = 0
    fA = f(A-1)
    fB = f(B)
    # print(fA, fB, sep="\n")
    for a, b in zip(fA, fB):
        v = max(b - a, 0)
        if v % 2 == 1:
            ans += 2**d
        d += 1
    print(ans)


if __name__ == '__main__':
    main() def main():
    A, B = (int(i) for i in input().split())

    def f(X):
        X += 1
        bi = []
        d = 2
        for i in range(40):
            v = (X//d) * (d//2) + max((X % d) - (d//2), 0)
            bi.append(v)
            d *= 2
        return bi

    ans = 0
    d = 0
    fA = f(A-1)
    fB = f(B)
    # print(fA, fB, sep="\n")
    for a, b in zip(fA, fB):
        v = max(b - a, 0)
        if v % 2 == 1:
            ans += 2**d
        d += 1
    print(ans) main int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i A, B = (int(i) for i in input().split()) A (int(i) for i in input().split()) B def f(X):
        X += 1
        bi = []
        d = 2
        for i in range(40):
            v = (X//d) * (d//2) + max((X % d) - (d//2), 0)
            bi.append(v)
            d *= 2
        return bi

     f X += 1 X 1 bi = [] bi [] d = 2 d 2 for i in range(40):
            v = (X//d) * (d//2) + max((X % d) - (d//2), 0)
            bi.append(v)
            d *= 2
         i range(40) range 40 v = (X//d) * (d//2) + max((X % d) - (d//2), 0) v (X//d) * (d//2) + max((X % d) - (d//2), 0) (X//d) * (d//2) X//d X d d//2 d 2 max((X % d) - (d//2), 0) max (X % d) - (d//2) X % d X d d//2 d 2 0 bi.append(v) bi.append bi append v d *= 2 d 2 return bi bi X X ans = 0 ans 0 d = 0 d 0 fA = f(A-1) fA f(A-1) f A-1 A 1 fB = f(B) fB f(B) f B for a, b in zip(fA, fB):
        v = max(b - a, 0)
        if v % 2 == 1:
            ans += 2**d
        d += 1
     a b zip(fA, fB) zip fA fB v = max(b - a, 0) v max(b - a, 0) max b - a b a 0 if v % 2 == 1:
            ans += 2**d
         v % 2 == 1 v % 2 v 2 1 ans += 2**d ans 2**d 2 d d += 1 d 1 print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    A, B = (int(i) for i in input().split())

    def f(X):
        X += 1
        bi = []
        d = 2
        for i in range(40):
            v = (X//d) * (d//2) + max((X % d) - (d//2), 0)
            bi.append(v)
            d *= 2
        return bi

    ans = 0
    d = 0
    fA = f(A-1)
    fB = f(B)
    # print(fA, fB, sep="\n")
    for a, b in zip(fA, fB):
        v = max(b - a, 0)
        if v % 2 == 1:
            ans += 2**d
        d += 1
    print(ans) def main():
    A, B = (int(i) for i in input().split())

    def f(X):
        X += 1
        bi = []
        d = 2
        for i in range(40):
            v = (X//d) * (d//2) + max((X % d) - (d//2), 0)
            bi.append(v)
            d *= 2
        return bi

    ans = 0
    d = 0
    fA = f(A-1)
    fB = f(B)
    # print(fA, fB, sep="\n")
    for a, b in zip(fA, fB):
        v = max(b - a, 0)
        if v % 2 == 1:
            ans += 2**d
        d += 1
    print(ans) main
def main():
    A, B = (int(i) for i in input().split())

    def f(X):
        X += 1
        bi = []
        d = 2
        for i in range(40):
            v = (X//d) * (d//2) + max((X % d) - (d//2), 0)
            bi.append(v)
            d *= 2
        return bi

    ans = 0
    d = 0
    fA = f(A-1)
    fB = f(B)
    # print(fA, fB, sep="\n")
    for a, b in zip(fA, fB):
        v = max(b - a, 0)
        if v % 2 == 1:
            ans += 2**d
        d += 1
    print(ans)


if __name__ == '__main__':
    main()
