D = int(input()) for i in range(60, 0, -1): x = 1 y = D while x + 1 < y: z = (x + y) // 2 Z = z a = 0 for _ in range(i): a += z z //= 2 if a >= D: y = Z else: x = Z a = 0 z = x + 1 for _ in range(i): a += z z //= 2 if a == D: print(x + 1) exit()