def solve(n):

    if n == 1: return 1

    return 2 * solve(n//2) + 1



print((solve(int(eval(input())))))

def solve(n):

    if n in memo: return memo[n]

    memo[n] = 2*solve(n//2)+1



    return memo[n]



memo = {1:1}



print((solve(int(eval(input())))))
def solve(n):
    if n == 1:
        return 1
    return 2 * solve(n // 2) + 1


print((solve(int(eval(input())))))

def solve(n):
    if n in memo:
        return memo[n]
    memo[n] = 2 * solve(n // 2) + 1
    return memo[n]


memo = {1: 1}
print((solve(int(eval(input())))))

-    if n == 1: -        return 1 -    return 2 * solve(n // 2) + 1 +    if n in memo: +        return memo[n] +    memo[n] = 2 * solve(n // 2) + 1 +    return memo[n] +memo = {1: 1}