import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


def f(n):
    if n % 2 == 0:
        a = n // 2
        if a % 2 == 0:
            return n
        else:
            return n ^ 1
    else:
        a = n // 2
        if a % 2 == 0:
            return 1
        else:
            return 0


def main():
    A, B = map(int, input().split())
    a = f(A - 1)
    b = f(B)
    answer = a ^ b

    print(answer)


if __name__ == "__main__":
    main() import sys sys def input():
    return sys.stdin.readline().strip() input return sys.stdin.readline().strip() sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip sys.setrecursionlimit(20000000) sys.setrecursionlimit sys setrecursionlimit 20000000 MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 INF = float("inf") INF float("inf") float "inf" def f(n):
    if n % 2 == 0:
        a = n // 2
        if a % 2 == 0:
            return n
        else:
            return n ^ 1
    else:
        a = n // 2
        if a % 2 == 0:
            return 1
        else:
            return 0 f if n % 2 == 0:
        a = n // 2
        if a % 2 == 0:
            return n
        else:
            return n ^ 1
    else:
        a = n // 2
        if a % 2 == 0:
            return 1
        else:
            return 0 n % 2 == 0 n % 2 n 2 0 a = n // 2 a n // 2 n 2 if a % 2 == 0:
            return n
        else:
            return n ^ 1
     a % 2 == 0 a % 2 a 2 0 return n n return n ^ 1 n ^ 1 n 1 a = n // 2 a n // 2 n 2 if a % 2 == 0:
            return 1
        else:
            return 0 a % 2 == 0 a % 2 a 2 0 return 1 1 return 0 0 n n def main():
    A, B = map(int, input().split())
    a = f(A - 1)
    b = f(B)
    answer = a ^ b

    print(answer) main A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B a = f(A - 1) a f(A - 1) f A - 1 A 1 b = f(B) b f(B) f B answer = a ^ b answer a ^ b a b print(answer) print answer if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    A, B = map(int, input().split())
    a = f(A - 1)
    b = f(B)
    answer = a ^ b

    print(answer) def main():
    A, B = map(int, input().split())
    a = f(A - 1)
    b = f(B)
    answer = a ^ b

    print(answer) main def f(n):
    if n % 2 == 0:
        a = n // 2
        if a % 2 == 0:
            return n
        else:
            return n ^ 1
    else:
        a = n // 2
        if a % 2 == 0:
            return 1
        else:
            return 0 def f(n):
    if n % 2 == 0:
        a = n // 2
        if a % 2 == 0:
            return n
        else:
            return n ^ 1
    else:
        a = n // 2
        if a % 2 == 0:
            return 1
        else:
            return 0 f MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD def input():
    return sys.stdin.readline().strip() def input():
    return sys.stdin.readline().strip() input INF = float("inf") float("inf") INF
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


def f(n):
    if n % 2 == 0:
        a = n // 2
        if a % 2 == 0:
            return n
        else:
            return n ^ 1
    else:
        a = n // 2
        if a % 2 == 0:
            return 1
        else:
            return 0


def main():
    A, B = map(int, input().split())
    a = f(A - 1)
    b = f(B)
    answer = a ^ b

    print(answer)


if __name__ == "__main__":
    main()
