#include using namespace std; using i64 = long long; i64 jump(i64 d, int t) { i64 ret = 0; for(int i = 1; i <= t; i ++) { ret += d; d /= 2; } return ret; } int main() { i64 d, ans = 1e18; cin >> d; for(int i = 1; i <= 70; i ++) { i64 l = 0, r = 1e18; while(l + 1 < r) { i64 mid = (l + r) / 2; if(jump(mid, i) < d) l = mid; else r = mid; } if(jump(r, i) == d) ans = min(ans, r); } cout << ans; }