#include using namespace std; long long F(long long X,long long K){ long long sum = 0; while (K>0) { sum += X; X /= 2; K--; } return sum; } int main(){ long long D; cin>>D; long long answer=9999999999999999999999999999; for (long long i = 0; i <= log2(D) + 1; i++) { long long le = 0, ri = D; while (ri - le > 1) { long long mid = (le + ri) / 2; if(F(mid, i) >= D)ri=mid; else le=mid; } if (F(ri, i) == D) answer = min(answer, ri); } cout<