H, A = map(int, input().split()) n = 0 ans = 1 while H != 0: ans += pow(2, n) H //= 2 print(ans)