mod = 1000000007 eps = 10**-9 def main(): import sys input = sys.stdin.readline D = int(input()) ans = D for N in range(2, 70): ok = D ng = 0 mid = (ok+ng) // 2 while ok - ng > 1: tmp = 0 x = mid for _ in range(N): tmp += x x //= 2 if tmp >= D: ok = mid else: ng = mid mid = (ok+ng)//2 tmp = 0 x = ok for _ in range(N): tmp += x x //= 2 if tmp == D: ans = min(ans, ok) print(ans) if __name__ == '__main__': main()