#include using namespace std; long long f(long long x, int N){ long long sum = 0; for (int i = 0; i < N; i++){ sum += x; x /= 2; } return sum; } int main(){ long long D; cin >> D; long long ans = D; for (int i = 1; i <= 100; i++){ long long tv = D; long long fv = 0; while (tv - fv > 1){ long long mid = (tv + fv) / 2; if (f(mid, i) >= D){ tv = mid; } else { fv = mid; } } if (f(tv, i) == D){ ans = min(ans, tv); } } cout << ans << endl; }