import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

A, B = MAP()
A -= 1
n = len(str(bin(B)))-2
a = [0]*n
b = [0]*n

def cnt_bit(cnt, N):
	for i in range(n):
		p = N//(2**(i+1)) * 2**i
		q = N%(2**(i+1))
		if 2**i <= q:
			p += min(2**i, q-(2**i-1))
		cnt[i] = p

cnt_bit(a, A)
cnt_bit(b, B)

ans = 0
for i in range(n):
	if (b[i]-a[i])%2:
		ans += 2**i

print(ans) import sys, re sys re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd, log from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_uppercase, digits from bisect import bisect, bisect_left, insort, insort_left from heapq import heappush, heappop from functools import reduce def input(): return sys.stdin.readline().strip() input def INT(): return int(input()) INT def MAP(): return map(int, input().split()) MAP def LIST(): return list(map(int, input().split())) LIST MAP() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) MAP() MAP def ZIP(n): return zip(*(MAP() for _ in range(n))) ZIP n n sys.setrecursionlimit(10 ** 9) sys.setrecursionlimit sys setrecursionlimit 10 ** 9 10 9 INF = float('inf') INF float('inf') float 'inf' mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 from decimal import * A, B = MAP() A MAP() MAP B A -= 1 A 1 n = len(str(bin(B)))-2 n len(str(bin(B)))-2 len(str(bin(B))) len str(bin(B)) str bin(B) bin B 2 a = [0]*n a [0]*n [0] 0 n b = [0]*n b [0]*n [0] 0 n def cnt_bit(cnt, N):
	for i in range(n):
		p = N//(2**(i+1)) * 2**i
		q = N%(2**(i+1))
		if 2**i <= q:
			p += min(2**i, q-(2**i-1))
		cnt[i] = p cnt_bit for i in range(n):
		p = N//(2**(i+1)) * 2**i
		q = N%(2**(i+1))
		if 2**i <= q:
			p += min(2**i, q-(2**i-1))
		cnt[i] = p i range(n) range n p = N//(2**(i+1)) * 2**i p N//(2**(i+1)) * 2**i N//(2**(i+1)) N 2**(i+1) 2 i+1 i 1 2**i 2 i q = N%(2**(i+1)) q N%(2**(i+1)) N 2**(i+1) 2 i+1 i 1 if 2**i <= q:
			p += min(2**i, q-(2**i-1))
		 2**i <= q 2**i 2 i q p += min(2**i, q-(2**i-1)) p min(2**i, q-(2**i-1)) min 2**i 2 i q-(2**i-1) q 2**i-1 2**i 2 i 1 cnt[i] = p cnt[i] cnt i p cnt cnt N N cnt_bit(a, A) cnt_bit a A cnt_bit(b, B) cnt_bit b B ans = 0 ans 0 for i in range(n):
	if (b[i]-a[i])%2:
		ans += 2**i i range(n) range n if (b[i]-a[i])%2:
		ans += 2**i (b[i]-a[i])%2 b[i]-a[i] b[i] b i a[i] a i 2 ans += 2**i ans 2**i 2 i print(ans) print ans b = [0]*n [0]*n b B = MAP() MAP() B def input(): return sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() input INF = float('inf') float('inf') INF mod = 10 ** 9 + 7 10 ** 9 + 7 mod A, B = MAP() MAP() A a = [0]*n [0]*n a def LIST(): return list(map(int, input().split())) def LIST(): return list(map(int, input().split())) LIST ans = 0 0 ans def INT(): return int(input()) def INT(): return int(input()) INT A -= 1 1 A def cnt_bit(cnt, N):
	for i in range(n):
		p = N//(2**(i+1)) * 2**i
		q = N%(2**(i+1))
		if 2**i <= q:
			p += min(2**i, q-(2**i-1))
		cnt[i] = p def cnt_bit(cnt, N):
	for i in range(n):
		p = N//(2**(i+1)) * 2**i
		q = N%(2**(i+1))
		if 2**i <= q:
			p += min(2**i, q-(2**i-1))
		cnt[i] = p cnt_bit def MAP(): return map(int, input().split()) def MAP(): return map(int, input().split()) MAP ans += 2**i 2**i ans n = len(str(bin(B)))-2 len(str(bin(B)))-2 n def ZIP(n): return zip(*(MAP() for _ in range(n))) def ZIP(n): return zip(*(MAP() for _ in range(n))) ZIP
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

A, B = MAP()
A -= 1
n = len(str(bin(B)))-2
a = [0]*n
b = [0]*n

def cnt_bit(cnt, N):
	for i in range(n):
		p = N//(2**(i+1)) * 2**i
		q = N%(2**(i+1))
		if 2**i <= q:
			p += min(2**i, q-(2**i-1))
		cnt[i] = p

cnt_bit(a, A)
cnt_bit(b, B)

ans = 0
for i in range(n):
	if (b[i]-a[i])%2:
		ans += 2**i

print(ans)