import sys input = lambda: sys.stdin.readline().rstrip() def get_max_beki(x) -> int: "Return max(k which 2**k <= x)." # assert x >= 0 ret = 0 while 2**(ret+1) <= x: ret += 1 return ret ################## a, b = map(int, input().split()) if a > b: a, b = b, a aa = get_max_beki(a) bb = get_max_beki(b) if aa < bb: print(a) else: print(2**aa - 1)