def main():
    A, B = map(int, input().split())
    res = 0
    if A % 2 == 0 and B % 2 == 1:
        res = ((B - A + 1) // 2) % 2
    elif A % 2 == 0 and B % 2 == 0:
        res = (((B - A) // 2) % 2)^B
    elif A % 2 == 1 and B % 2 == 0:
        res = (((B - A - 1) // 2) % 2)^A^B
    else:
        res = (((B - A) // 2) % 2)^A

    print(res)

if __name__ == "__main__":
    main() def main():
    A, B = map(int, input().split())
    res = 0
    if A % 2 == 0 and B % 2 == 1:
        res = ((B - A + 1) // 2) % 2
    elif A % 2 == 0 and B % 2 == 0:
        res = (((B - A) // 2) % 2)^B
    elif A % 2 == 1 and B % 2 == 0:
        res = (((B - A - 1) // 2) % 2)^A^B
    else:
        res = (((B - A) // 2) % 2)^A

    print(res) main A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B res = 0 res 0 if A % 2 == 0 and B % 2 == 1:
        res = ((B - A + 1) // 2) % 2
    elif A % 2 == 0 and B % 2 == 0:
        res = (((B - A) // 2) % 2)^B
    elif A % 2 == 1 and B % 2 == 0:
        res = (((B - A - 1) // 2) % 2)^A^B
    else:
        res = (((B - A) // 2) % 2)^A

     A % 2 == 0 and B % 2 == 1 A % 2 == 0 A % 2 A 2 0 B % 2 == 1 B % 2 B 2 1 res = ((B - A + 1) // 2) % 2 res ((B - A + 1) // 2) % 2 (B - A + 1) // 2 B - A + 1 B - A B A 1 2 2 elif A % 2 == 0 and B % 2 == 0:
        res = (((B - A) // 2) % 2)^B
     A % 2 == 0 and B % 2 == 0 A % 2 == 0 A % 2 A 2 0 B % 2 == 0 B % 2 B 2 0 res = (((B - A) // 2) % 2)^B res (((B - A) // 2) % 2)^B ((B - A) // 2) % 2 (B - A) // 2 B - A B A 2 2 B elif A % 2 == 1 and B % 2 == 0:
        res = (((B - A - 1) // 2) % 2)^A^B
     A % 2 == 1 and B % 2 == 0 A % 2 == 1 A % 2 A 2 1 B % 2 == 0 B % 2 B 2 0 res = (((B - A - 1) // 2) % 2)^A^B res (((B - A - 1) // 2) % 2)^A^B (((B - A - 1) // 2) % 2)^A ((B - A - 1) // 2) % 2 (B - A - 1) // 2 B - A - 1 B - A B A 1 2 2 A B res = (((B - A) // 2) % 2)^A res (((B - A) // 2) % 2)^A ((B - A) // 2) % 2 (B - A) // 2 B - A B A 2 2 A print(res) print res if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    A, B = map(int, input().split())
    res = 0
    if A % 2 == 0 and B % 2 == 1:
        res = ((B - A + 1) // 2) % 2
    elif A % 2 == 0 and B % 2 == 0:
        res = (((B - A) // 2) % 2)^B
    elif A % 2 == 1 and B % 2 == 0:
        res = (((B - A - 1) // 2) % 2)^A^B
    else:
        res = (((B - A) // 2) % 2)^A

    print(res) def main():
    A, B = map(int, input().split())
    res = 0
    if A % 2 == 0 and B % 2 == 1:
        res = ((B - A + 1) // 2) % 2
    elif A % 2 == 0 and B % 2 == 0:
        res = (((B - A) // 2) % 2)^B
    elif A % 2 == 1 and B % 2 == 0:
        res = (((B - A - 1) // 2) % 2)^A^B
    else:
        res = (((B - A) // 2) % 2)^A

    print(res) main
def main():
    A, B = map(int, input().split())
    res = 0
    if A % 2 == 0 and B % 2 == 1:
        res = ((B - A + 1) // 2) % 2
    elif A % 2 == 0 and B % 2 == 0:
        res = (((B - A) // 2) % 2)^B
    elif A % 2 == 1 and B % 2 == 0:
        res = (((B - A - 1) // 2) % 2)^A^B
    else:
        res = (((B - A) // 2) % 2)^A

    print(res)

if __name__ == "__main__":
    main()