# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
from heapq import heappop, heappush
from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import product, accumulate, combinations, product
#import bisect
#import numpy as np
#from copy import deepcopy
#from collections import deque
#from decimal import Decimal
#from numba import jit

INF = 1 << 50
EPS = 1e-8
mod = 10 ** 9 + 7

def mapline(t = int):
    return map(t, sysread().split())
def mapread(t = int):
    return map(t, read().split())

def counts(A):
    L = A.bit_length()
    ans = 0
    for l in range(L):
        if l == 0:
            s = A // 2
            s = s % 2
            if A % 2:
                ans = s ^ 1
            else:
                ans = s
        else:
            if (A >> l) & 1:
                v = A - ((A >> l) << l) + 1
                if v % 2:
                    ans |= 1 << l
    return ans

def run():
    A, B = mapline()
    a = counts(A-1)
    b = counts(B)

    print(a ^ b)
if __name__ == "__main__":
    run() import sys sys sysread = sys.stdin.buffer.readline sysread sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read from heapq import heappop, heappush from collections import defaultdict sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 import math math INF = 1 << 50 INF 1 << 50 1 50 EPS = 1e-8 EPS 1e-8 mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 def mapline(t = int):
    return map(t, sysread().split()) mapline return map(t, sysread().split()) map(t, sysread().split()) map t sysread().split() ().split () sysread split t = int t int def mapread(t = int):
    return map(t, read().split()) mapread return map(t, read().split()) map(t, read().split()) map t read().split() ().split () read split t = int t int def counts(A):
    L = A.bit_length()
    ans = 0
    for l in range(L):
        if l == 0:
            s = A // 2
            s = s % 2
            if A % 2:
                ans = s ^ 1
            else:
                ans = s
        else:
            if (A >> l) & 1:
                v = A - ((A >> l) << l) + 1
                if v % 2:
                    ans |= 1 << l
    return ans counts L = A.bit_length() L A.bit_length() A.bit_length A bit_length ans = 0 ans 0 for l in range(L):
        if l == 0:
            s = A // 2
            s = s % 2
            if A % 2:
                ans = s ^ 1
            else:
                ans = s
        else:
            if (A >> l) & 1:
                v = A - ((A >> l) << l) + 1
                if v % 2:
                    ans |= 1 << l
     l range(L) range L if l == 0:
            s = A // 2
            s = s % 2
            if A % 2:
                ans = s ^ 1
            else:
                ans = s
        else:
            if (A >> l) & 1:
                v = A - ((A >> l) << l) + 1
                if v % 2:
                    ans |= 1 << l
     l == 0 l 0 s = A // 2 s A // 2 A 2 s = s % 2 s s % 2 s 2 if A % 2:
                ans = s ^ 1
            else:
                ans = s
         A % 2 A 2 ans = s ^ 1 ans s ^ 1 s 1 ans = s ans s if (A >> l) & 1:
                v = A - ((A >> l) << l) + 1
                if v % 2:
                    ans |= 1 << l
     (A >> l) & 1 A >> l A l 1 v = A - ((A >> l) << l) + 1 v A - ((A >> l) << l) + 1 A - ((A >> l) << l) A (A >> l) << l A >> l A l l 1 if v % 2:
                    ans |= 1 << l
     v % 2 v 2 ans |= 1 << l ans 1 << l 1 l return ans ans A A def run():
    A, B = mapline()
    a = counts(A-1)
    b = counts(B)

    print(a ^ b) run A, B = mapline() A mapline() mapline B a = counts(A-1) a counts(A-1) counts A-1 A 1 b = counts(B) b counts(B) counts B print(a ^ b) print a ^ b a b if __name__ == "__main__":
    run() __name__ == "__main__" __name__ "__main__" run() run def mapline(t = int):
    return map(t, sysread().split()) def mapline(t = int):
    return map(t, sysread().split()) mapline mod = 10 ** 9 + 7 10 ** 9 + 7 mod INF = 1 << 50 1 << 50 INF def mapread(t = int):
    return map(t, read().split()) def mapread(t = int):
    return map(t, read().split()) mapread sysread = sys.stdin.buffer.readline sys.stdin.buffer.readline sysread EPS = 1e-8 1e-8 EPS read = sys.stdin.buffer.read sys.stdin.buffer.read read def run():
    A, B = mapline()
    a = counts(A-1)
    b = counts(B)

    print(a ^ b) def run():
    A, B = mapline()
    a = counts(A-1)
    b = counts(B)

    print(a ^ b) run def counts(A):
    L = A.bit_length()
    ans = 0
    for l in range(L):
        if l == 0:
            s = A // 2
            s = s % 2
            if A % 2:
                ans = s ^ 1
            else:
                ans = s
        else:
            if (A >> l) & 1:
                v = A - ((A >> l) << l) + 1
                if v % 2:
                    ans |= 1 << l
    return ans def counts(A):
    L = A.bit_length()
    ans = 0
    for l in range(L):
        if l == 0:
            s = A // 2
            s = s % 2
            if A % 2:
                ans = s ^ 1
            else:
                ans = s
        else:
            if (A >> l) & 1:
                v = A - ((A >> l) << l) + 1
                if v % 2:
                    ans |= 1 << l
    return ans counts
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
from heapq import heappop, heappush
from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import product, accumulate, combinations, product
#import bisect
#import numpy as np
#from copy import deepcopy
#from collections import deque
#from decimal import Decimal
#from numba import jit

INF = 1 << 50
EPS = 1e-8
mod = 10 ** 9 + 7

def mapline(t = int):
    return map(t, sysread().split())
def mapread(t = int):
    return map(t, read().split())

def counts(A):
    L = A.bit_length()
    ans = 0
    for l in range(L):
        if l == 0:
            s = A // 2
            s = s % 2
            if A % 2:
                ans = s ^ 1
            else:
                ans = s
        else:
            if (A >> l) & 1:
                v = A - ((A >> l) << l) + 1
                if v % 2:
                    ans |= 1 << l
    return ans

def run():
    A, B = mapline()
    a = counts(A-1)
    b = counts(B)

    print(a ^ b)
if __name__ == "__main__":
    run()
