def xor_sum(a):
    if a == 0 or a == 1:
        return a
    elif a == 2:
        return 3
    elif a == 3:
        return 0
    else:
        b = bin(a)[2:]
        if a % 2 == 0:
            return 2**(len(b)-1) + xor_sum(a % 2**(len(b)-1))
        else:
            return xor_sum(a % 2**(len(b)-1))

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

    a,b = xor_sum(max(0,A-1)),xor_sum(B)
    print(a ^ b)

if __name__ == "__main__":
    main() def xor_sum(a):
    if a == 0 or a == 1:
        return a
    elif a == 2:
        return 3
    elif a == 3:
        return 0
    else:
        b = bin(a)[2:]
        if a % 2 == 0:
            return 2**(len(b)-1) + xor_sum(a % 2**(len(b)-1))
        else:
            return xor_sum(a % 2**(len(b)-1)) xor_sum if a == 0 or a == 1:
        return a
    elif a == 2:
        return 3
    elif a == 3:
        return 0
    else:
        b = bin(a)[2:]
        if a % 2 == 0:
            return 2**(len(b)-1) + xor_sum(a % 2**(len(b)-1))
        else:
            return xor_sum(a % 2**(len(b)-1)) a == 0 or a == 1 a == 0 a 0 a == 1 a 1 return a a elif a == 2:
        return 3
     a == 2 a 2 return 3 3 elif a == 3:
        return 0
     a == 3 a 3 return 0 0 b = bin(a)[2:] b bin(a)[2:] (a) bin a 2: 2 if a % 2 == 0:
            return 2**(len(b)-1) + xor_sum(a % 2**(len(b)-1))
        else:
            return xor_sum(a % 2**(len(b)-1)) a % 2 == 0 a % 2 a 2 0 return 2**(len(b)-1) + xor_sum(a % 2**(len(b)-1)) 2**(len(b)-1) + xor_sum(a % 2**(len(b)-1)) 2**(len(b)-1) 2 len(b)-1 len(b) len b 1 xor_sum(a % 2**(len(b)-1)) xor_sum a % 2**(len(b)-1) a 2**(len(b)-1) 2 len(b)-1 len(b) len b 1 return xor_sum(a % 2**(len(b)-1)) xor_sum(a % 2**(len(b)-1)) xor_sum a % 2**(len(b)-1) a 2**(len(b)-1) 2 len(b)-1 len(b) len b 1 a a def main():
    A,B = map(int,input().split())

    a,b = xor_sum(max(0,A-1)),xor_sum(B)
    print(a ^ b) main A,B = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B a,b = xor_sum(max(0,A-1)),xor_sum(B) a xor_sum(max(0,A-1)) xor_sum max(0,A-1) max 0 A-1 A 1 b xor_sum(B) xor_sum B print(a ^ b) print a ^ b a b if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def xor_sum(a):
    if a == 0 or a == 1:
        return a
    elif a == 2:
        return 3
    elif a == 3:
        return 0
    else:
        b = bin(a)[2:]
        if a % 2 == 0:
            return 2**(len(b)-1) + xor_sum(a % 2**(len(b)-1))
        else:
            return xor_sum(a % 2**(len(b)-1)) def xor_sum(a):
    if a == 0 or a == 1:
        return a
    elif a == 2:
        return 3
    elif a == 3:
        return 0
    else:
        b = bin(a)[2:]
        if a % 2 == 0:
            return 2**(len(b)-1) + xor_sum(a % 2**(len(b)-1))
        else:
            return xor_sum(a % 2**(len(b)-1)) xor_sum def main():
    A,B = map(int,input().split())

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

    a,b = xor_sum(max(0,A-1)),xor_sum(B)
    print(a ^ b) main
def xor_sum(a):
    if a == 0 or a == 1:
        return a
    elif a == 2:
        return 3
    elif a == 3:
        return 0
    else:
        b = bin(a)[2:]
        if a % 2 == 0:
            return 2**(len(b)-1) + xor_sum(a % 2**(len(b)-1))
        else:
            return xor_sum(a % 2**(len(b)-1))

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

    a,b = xor_sum(max(0,A-1)),xor_sum(B)
    print(a ^ b)

if __name__ == "__main__":
    main()
