def f(x):
    cou = 0
    re = 0
    while True:
        if x < 2**cou:
            break
        if cou == 0:
            if 1 <= x % 4 <= 2:
                re += 1
        else:
            p = x % (2**(cou+1))
            if 2**cou <= p and p % 2 == 0:
                re += 2**cou
        cou += 1
    return re
a , b = map(int,input().split())

print(f(a-1) ^ f(b)) def f(x):
    cou = 0
    re = 0
    while True:
        if x < 2**cou:
            break
        if cou == 0:
            if 1 <= x % 4 <= 2:
                re += 1
        else:
            p = x % (2**(cou+1))
            if 2**cou <= p and p % 2 == 0:
                re += 2**cou
        cou += 1
    return re f cou = 0 cou 0 re = 0 re 0 while True:
        if x < 2**cou:
            break
        if cou == 0:
            if 1 <= x % 4 <= 2:
                re += 1
        else:
            p = x % (2**(cou+1))
            if 2**cou <= p and p % 2 == 0:
                re += 2**cou
        cou += 1
     True if x < 2**cou:
            break
         x < 2**cou x 2**cou 2 cou break if cou == 0:
            if 1 <= x % 4 <= 2:
                re += 1
        else:
            p = x % (2**(cou+1))
            if 2**cou <= p and p % 2 == 0:
                re += 2**cou
         cou == 0 cou 0 if 1 <= x % 4 <= 2:
                re += 1
         1 <= x % 4 <= 2 1 <= x % 4 1 x % 4 x 4 2 re += 1 re 1 p = x % (2**(cou+1)) p x % (2**(cou+1)) x 2**(cou+1) 2 cou+1 cou 1 if 2**cou <= p and p % 2 == 0:
                re += 2**cou
         2**cou <= p and p % 2 == 0 2**cou <= p 2**cou 2 cou p p % 2 == 0 p % 2 p 2 0 re += 2**cou re 2**cou 2 cou cou += 1 cou 1 return re re x x a , b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b print(f(a-1) ^ f(b)) print f(a-1) ^ f(b) f(a-1) f a-1 a 1 f(b) f b b = map(int,input().split()) map(int,input().split()) b a , b = map(int,input().split()) map(int,input().split()) a def f(x):
    cou = 0
    re = 0
    while True:
        if x < 2**cou:
            break
        if cou == 0:
            if 1 <= x % 4 <= 2:
                re += 1
        else:
            p = x % (2**(cou+1))
            if 2**cou <= p and p % 2 == 0:
                re += 2**cou
        cou += 1
    return re def f(x):
    cou = 0
    re = 0
    while True:
        if x < 2**cou:
            break
        if cou == 0:
            if 1 <= x % 4 <= 2:
                re += 1
        else:
            p = x % (2**(cou+1))
            if 2**cou <= p and p % 2 == 0:
                re += 2**cou
        cou += 1
    return re f
def f(x):
    cou = 0
    re = 0
    while True:
        if x < 2**cou:
            break
        if cou == 0:
            if 1 <= x % 4 <= 2:
                re += 1
        else:
            p = x % (2**(cou+1))
            if 2**cou <= p and p % 2 == 0:
                re += 2**cou
        cou += 1
    return re
a , b = map(int,input().split())

print(f(a-1) ^ f(b))