import sys

input = sys.stdin.readline


def g(n):
    if n == -1:
        return 0
    if n == 0:
        return 0
    if n == 1:
        return 1

    b = bin(n)[2:]
    res = 0
    # xxxx10: 01, 10
    if b[-2:] == "10":
        res += 3
    # xxxx11: 01, 10, 11
    elif b[-2:] == "11":
        pass
    # xxxx00 or xxxx01
    else:
        res += int(b[-1])

    for i in range(len(b) - 2):
        if b[i] == "0":
            continue
        if b[-1] == "0":
            res += 1 << (len(b) - 1 - i)
    return res


def main():
    A, B = map(int, input().split())

    if A == B:
        ans = A
    else:
        ans = g(A - 1) ^ g(B)

    print(ans)


if __name__ == "__main__":
    main() import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline def g(n):
    if n == -1:
        return 0
    if n == 0:
        return 0
    if n == 1:
        return 1

    b = bin(n)[2:]
    res = 0
    # xxxx10: 01, 10
    if b[-2:] == "10":
        res += 3
    # xxxx11: 01, 10, 11
    elif b[-2:] == "11":
        pass
    # xxxx00 or xxxx01
    else:
        res += int(b[-1])

    for i in range(len(b) - 2):
        if b[i] == "0":
            continue
        if b[-1] == "0":
            res += 1 << (len(b) - 1 - i)
    return res g if n == -1:
        return 0
     n == -1 n -1 return 0 0 if n == 0:
        return 0
     n == 0 n 0 return 0 0 if n == 1:
        return 1

     n == 1 n 1 return 1 1 b = bin(n)[2:] b bin(n)[2:] (n) bin n 2: 2 res = 0 res 0 if b[-2:] == "10":
        res += 3
    # xxxx11: 01, 10, 11
    elif b[-2:] == "11":
        pass
    # xxxx00 or xxxx01
    else:
        res += int(b[-1])

     b[-2:] == "10" b[-2:] b -2: -2 "10" res += 3 res 3 elif b[-2:] == "11":
        pass
    # xxxx00 or xxxx01
     b[-2:] == "11" b[-2:] b -2: -2 "11" res += int(b[-1]) res int(b[-1]) int b[-1] b -1 for i in range(len(b) - 2):
        if b[i] == "0":
            continue
        if b[-1] == "0":
            res += 1 << (len(b) - 1 - i)
     i range(len(b) - 2) range len(b) - 2 len(b) len b 2 if b[i] == "0":
            continue
         b[i] == "0" b[i] b i "0" continue if b[-1] == "0":
            res += 1 << (len(b) - 1 - i)
     b[-1] == "0" b[-1] b -1 "0" res += 1 << (len(b) - 1 - i) res 1 << (len(b) - 1 - i) 1 len(b) - 1 - i len(b) - 1 len(b) len b 1 i return res res n n def main():
    A, B = map(int, input().split())

    if A == B:
        ans = A
    else:
        ans = g(A - 1) ^ g(B)

    print(ans) main A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B if A == B:
        ans = A
    else:
        ans = g(A - 1) ^ g(B)

     A == B A B ans = A ans A ans = g(A - 1) ^ g(B) ans g(A - 1) ^ g(B) g(A - 1) g A - 1 A 1 g(B) g B print(ans) print ans if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main input = sys.stdin.readline sys.stdin.readline input def main():
    A, B = map(int, input().split())

    if A == B:
        ans = A
    else:
        ans = g(A - 1) ^ g(B)

    print(ans) def main():
    A, B = map(int, input().split())

    if A == B:
        ans = A
    else:
        ans = g(A - 1) ^ g(B)

    print(ans) main def g(n):
    if n == -1:
        return 0
    if n == 0:
        return 0
    if n == 1:
        return 1

    b = bin(n)[2:]
    res = 0
    # xxxx10: 01, 10
    if b[-2:] == "10":
        res += 3
    # xxxx11: 01, 10, 11
    elif b[-2:] == "11":
        pass
    # xxxx00 or xxxx01
    else:
        res += int(b[-1])

    for i in range(len(b) - 2):
        if b[i] == "0":
            continue
        if b[-1] == "0":
            res += 1 << (len(b) - 1 - i)
    return res def g(n):
    if n == -1:
        return 0
    if n == 0:
        return 0
    if n == 1:
        return 1

    b = bin(n)[2:]
    res = 0
    # xxxx10: 01, 10
    if b[-2:] == "10":
        res += 3
    # xxxx11: 01, 10, 11
    elif b[-2:] == "11":
        pass
    # xxxx00 or xxxx01
    else:
        res += int(b[-1])

    for i in range(len(b) - 2):
        if b[i] == "0":
            continue
        if b[-1] == "0":
            res += 1 << (len(b) - 1 - i)
    return res g
import sys

input = sys.stdin.readline


def g(n):
    if n == -1:
        return 0
    if n == 0:
        return 0
    if n == 1:
        return 1

    b = bin(n)[2:]
    res = 0
    # xxxx10: 01, 10
    if b[-2:] == "10":
        res += 3
    # xxxx11: 01, 10, 11
    elif b[-2:] == "11":
        pass
    # xxxx00 or xxxx01
    else:
        res += int(b[-1])

    for i in range(len(b) - 2):
        if b[i] == "0":
            continue
        if b[-1] == "0":
            res += 1 << (len(b) - 1 - i)
    return res


def main():
    A, B = map(int, input().split())

    if A == B:
        ans = A
    else:
        ans = g(A - 1) ^ g(B)

    print(ans)


if __name__ == "__main__":
    main()
