import sys input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) INF = 2 ** 63 - 1 mod = 998244353 a, b = mi() if a > b: a, b = b, a y = 0 x = 0 for i in range(0, 33): if 2 ** i <= b: y = 2 ** i for i in range(0, 33): if 2 ** i - 1 <= a: x = 2 ** i - 1 print(min(x, y, x ^ y))