import sys sys.setrecursionlimit(10**7) from functools import lru_cache @lru_cache(maxsize=None) def dfs(H): if H==0: return 0 return dfs(H//2)*2+1 H,A = map(int, input().split()) print(dfs(H))