# 2つの変数がある、K回跳ねる、距離x # 1つを固定する、K回を決めたときの距離xは何になるか、そのときにDに止まるか # K<64でよい、それで10**18もゼロになる D = int(input()) def distance(K, x): dist = 0 for i in range(K): dist += x x //= 2 return dist #distance(3, 6) def check_K(K): OK = 10**20 NG = 0 while OK-NG>1: mid = (OK+NG)//2 if distance(K, mid) >= D: OK = mid else: NG = mid if distance(K, OK) == D: return 1, OK else: return 0, 'nosolution' ans = 10**20 for k in range(1, 65): #print(k, check_K(k)) if check_K(k)[0] == 1: ans = min(ans, check_K(k)[1]) print(ans)